1 ; Test that the StrChrOptimizer works correctly
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
3 ; RUN: not grep {call.*%strchr}
5 declare sbyte* %strchr(sbyte*,int)
6 declare int %puts(sbyte*)
7 %hello = constant [14 x sbyte] c"hello world\n\00"
8 %null = constant [1 x sbyte] c"\00"
10 implementation ; Functions:
13 %hello_p = getelementptr [14 x sbyte]* %hello, int 0, int 0
14 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
16 %world = call sbyte* %strchr(sbyte* %hello_p, int 119 )
17 %ignore = call sbyte* %strchr(sbyte* %null_p, int 119 )
18 %len = call int %puts(sbyte* %world)
19 %index = add int %len, 112
20 %result = call sbyte* %strchr(sbyte* %hello_p, int %index)