Chris Lattner | 3d2e54b | 2007-04-06 23:36:59 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | opt -simplify-libcalls -instcombine | llvm-dis > %t && |
| 2 | ; RUN: grep '@str,.*i64 3' %t && |
| 3 | ; RUN: grep '@str1,.*i64 7' %t && |
| 4 | ; RUN: grep 'ret i8.*null' %t |
| 5 | ; PR1307 |
| 6 | |
| 7 | @str = internal constant [5 x i8] c"foog\00" |
| 8 | @str1 = internal constant [8 x i8] c"blahhh!\00" |
| 9 | @str2 = internal constant [5 x i8] c"Ponk\00" |
| 10 | |
| 11 | define i8* @test1() { |
| 12 | %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; <i8*> [#uses=1] |
| 13 | ret i8* %tmp3 |
| 14 | } |
| 15 | |
| 16 | declare i8* @strchr(i8*, i32) |
| 17 | |
| 18 | define i8* @test2() { |
| 19 | %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; <i8*> [#uses=1] |
| 20 | ret i8* %tmp3 |
| 21 | } |
| 22 | |
| 23 | define i8* @test3() { |
| 24 | entry: |
| 25 | %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; <i8*> [#uses=1] |
| 26 | ret i8* %tmp3 |
| 27 | } |
| 28 | |