1 ; Test that the StrCatOptimizer works correctly
2 ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*strlen'
4 declare uint %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"
9 implementation ; Functions:
12 %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0
13 %hello_l = call uint %strlen(sbyte* %hello_p)
18 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
19 %null_l = call uint %strlen(sbyte* %null_p)
24 %null_hello_p = getelementptr [7 x sbyte]* %null_hello, int 0, int 0
25 %null_hello_l = call uint %strlen(sbyte* %null_hello_p)
26 ret uint %null_hello_l
30 %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0
31 %hello_l = call uint %strlen(sbyte* %hello_p)
32 %eq_hello = seteq uint %hello_l, 0
37 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
38 %null_l = call uint %strlen(sbyte* %null_p)
39 %eq_null = seteq uint %null_l, 0
44 %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0
45 %hello_l = call uint %strlen(sbyte* %hello_p)
46 %ne_hello = setne uint %hello_l, 0
51 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
52 %null_l = call uint %strlen(sbyte* %null_p)
53 %ne_null = setne uint %null_l, 0