blob: 0a99488197bedab903dd8c208614e276ea7d4627 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; Test that the StrCatOptimizer works correctly
2; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -simplify-libcalls | \
3; RUN: llvm-dis | not grep {call.*llvm.memcpy.i32}
4
5declare void %llvm.memcpy.i32(sbyte*,sbyte*,uint,uint)
6%h = constant [2 x sbyte] c"h\00"
7%hel = constant [4 x sbyte] c"hel\00"
8%hello_u = constant [8 x sbyte] c"hello_u\00"
9
10implementation ; Functions:
11
12int %main () {
13 %h_p = getelementptr [2 x sbyte]* %h, int 0, int 0
14 %hel_p = getelementptr [4 x sbyte]* %hel, int 0, int 0
15 %hello_u_p = getelementptr [8 x sbyte]* %hello_u, int 0, int 0
16 %target = alloca [1024 x sbyte]
17 %target_p = getelementptr [1024 x sbyte]* %target, int 0, int 0
18 call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %h_p, uint 2, uint 2)
19 call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %hel_p, uint 4, uint 4)
20 call void %llvm.memcpy.i32(sbyte* %target_p, sbyte* %hello_u_p, uint 8, uint 8)
21 ret int 0
22}