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