Reid Spencer | 34efdf8 | 2005-05-03 06:22:41 +0000 | [diff] [blame^] | 1 | ; Test that the StrChrOptimizer works correctly |
| 2 | ; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*strchr' |
| 3 | |
| 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" |
| 8 | |
| 9 | implementation ; Functions: |
| 10 | |
| 11 | int %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 | } |