Expose Module::dump via C and Ocaml.
[oota-llvm.git] / test / Transforms / SimplifyLibCalls / MemCpy.ll
1 ; Test that the StrCatOptimizer works correctly
2 ; RUN: llvm-as < %s | opt -constprop -simplify-libcalls | \
3 ; RUN:   llvm-dis | not grep {call.*llvm.memcpy.i32}
4
5 @h = constant [2 x i8] c"h\00"          ; <[2 x i8]*> [#uses=1]
6 @hel = constant [4 x i8] c"hel\00"              ; <[4 x i8]*> [#uses=1]
7 @hello_u = constant [8 x i8] c"hello_u\00"              ; <[8 x i8]*> [#uses=1]
8
9 declare void @llvm.memcpy.i32(i8*, i8*, i32, i32)
10
11 define i32 @main() {
12         %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0         ; <i8*> [#uses=1]
13         %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0             ; <i8*> [#uses=1]
14         %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0             ; <i8*> [#uses=1]
15         %target = alloca [1024 x i8]            ; <[1024 x i8]*> [#uses=1]
16         %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0            ; <i8*> [#uses=3]
17         call void @llvm.memcpy.i32( i8* %target_p, i8* %h_p, i32 2, i32 2 )
18         call void @llvm.memcpy.i32( i8* %target_p, i8* %hel_p, i32 4, i32 4 )
19         call void @llvm.memcpy.i32( i8* %target_p, i8* %hello_u_p, i32 8, i32 8 )
20         ret i32 0
21 }
22