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