blob: 7594fee4b16994305e68380c5cc2841710b601b1 [file] [log] [blame]
Reid Spencer34efdf82005-05-03 06:22:41 +00001; Test that the StrChrOptimizer works correctly
2; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*strchr'
3
4declare sbyte* %strchr(sbyte*,int)
5declare int %puts(sbyte*)
6%hello = constant [14 x sbyte] c"hello world\n\00"
7%null = constant [1 x sbyte] c"\00"
8
9implementation ; Functions:
10
11int %main () {
12 %hello_p = getelementptr [14 x sbyte]* %hello, int 0, int 0
13 %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0
14
15 %world = call sbyte* %strchr(sbyte* %hello_p, int 119 )
16 %ignore = call sbyte* %strchr(sbyte* %null_p, int 119 )
17 %result = call int %puts(sbyte* %world)
18 ret int %result
19}