blob: 0e1750162f9d3fd34b9fef3f9ba1cca1f90d3e1b [file] [log] [blame]
Reid Spencer8fe86dd2005-04-26 05:22:38 +00001; Test that the StrCatOptimizer works correctly
2; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*strlen'
3
4declare int %strlen(sbyte*)
5%hello = constant [6 x sbyte] c"hello\00"
6%null = constant [1 x sbyte] c"\00"
7%null_hello = constant [7 x sbyte] c"\00hello\00"
8
9implementation ; Functions:
10
11int %main () {
12 %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0
13 %hello_l = call int %strlen(sbyte* %hello_p)
14 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
15 %null_l = call int %strlen(sbyte* %null_p)
16 %null_hello_p = getelementptr [7 x sbyte]* %null_hello, int 0, int 0
17 %null_hello_l = call int %strlen(sbyte* %null_hello_p)
18 %sum1 = add int %hello_l, %null_l
19 %sum2 = add int %sum1, %null_hello_l
20 ret int %sum2
21}