blob: 1855c0d3869ef4bb021e811889fb2ecd21992aff [file] [log] [blame]
Reid Spencer45254f72005-04-29 06:01:28 +00001; Test that the StrCatOptimizer works correctly
2; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*strcat'
3
4declare sbyte* %strcpy(sbyte*,sbyte*)
5declare int %puts(sbyte*)
6%hello = constant [6 x sbyte] c"hello\00"
7%null = constant [1 x sbyte] c"\00"
8%null_hello = constant [7 x sbyte] c"\00hello\00"
9
10implementation ; Functions:
11
12int %main () {
13 %target = alloca [1024 x sbyte]
14 %arg1 = getelementptr [1024 x sbyte]* %target, int 0, int 0
15 store sbyte 0, sbyte* %arg1
16 %arg2 = getelementptr [6 x sbyte]* %hello, int 0, int 0
17 %rslt1 = call sbyte* %strcpy(sbyte* %arg1, sbyte* %arg2)
18 %arg3 = getelementptr [1 x sbyte]* %null, int 0, int 0
19 %rslt2 = call sbyte* %strcpy(sbyte* %rslt1, sbyte* %arg3)
20 %arg4 = getelementptr [7 x sbyte]* %null_hello, int 0, int 0
21 %rslt3 = call sbyte* %strcpy(sbyte* %rslt2, sbyte* %arg4)
22 call int %puts(sbyte* %rslt3)
23 ret int 0
24}