1 ; Test that the StrCatOptimizer works correctly
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
3 ; RUN: not grep {call.*strlen}
5 target datalayout = "e-p:32:32"
7 declare uint %strlen(sbyte*)
8 %hello = constant [6 x sbyte] c"hello\00"
9 %null = constant [1 x sbyte] c"\00"
10 %null_hello = constant [7 x sbyte] c"\00hello\00"
12 implementation ; Functions:
15 %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0
16 %hello_l = call uint %strlen(sbyte* %hello_p)
21 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
22 %null_l = call uint %strlen(sbyte* %null_p)
27 %null_hello_p = getelementptr [7 x sbyte]* %null_hello, int 0, int 0
28 %null_hello_l = call uint %strlen(sbyte* %null_hello_p)
29 ret uint %null_hello_l
33 %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0
34 %hello_l = call uint %strlen(sbyte* %hello_p)
35 %eq_hello = seteq uint %hello_l, 0
40 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
41 %null_l = call uint %strlen(sbyte* %null_p)
42 %eq_null = seteq uint %null_l, 0
47 %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0
48 %hello_l = call uint %strlen(sbyte* %hello_p)
49 %ne_hello = setne uint %hello_l, 0
54 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
55 %null_l = call uint %strlen(sbyte* %null_p)
56 %ne_null = setne uint %null_l, 0