Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ; PR1307 |
Dan Gohman | 3c7d308 | 2009-09-11 18:01:28 +0000 | [diff] [blame] | 2 | ; RUN: opt < %s -simplify-libcalls -instcombine -S > %t |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3 | ; RUN: grep {@str,.*i64 3} %t |
| 4 | ; RUN: grep {@str1,.*i64 7} %t |
| 5 | ; RUN: grep {ret i8.*null} %t |
| 6 | ; END. |
| 7 | |
| 8 | @str = internal constant [5 x i8] c"foog\00" |
| 9 | @str1 = internal constant [8 x i8] c"blahhh!\00" |
| 10 | @str2 = internal constant [5 x i8] c"Ponk\00" |
| 11 | |
| 12 | define i8* @test1() { |
| 13 | %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; <i8*> [#uses=1] |
| 14 | ret i8* %tmp3 |
| 15 | } |
| 16 | |
| 17 | declare i8* @strchr(i8*, i32) |
| 18 | |
| 19 | define i8* @test2() { |
| 20 | %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; <i8*> [#uses=1] |
| 21 | ret i8* %tmp3 |
| 22 | } |
| 23 | |
| 24 | define i8* @test3() { |
| 25 | entry: |
| 26 | %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; <i8*> [#uses=1] |
| 27 | ret i8* %tmp3 |
| 28 | } |
| 29 | |