Chris Lattner | 3d2e54b | 2007-04-06 23:36:59 +0000 | [diff] [blame] | 1 | ; PR1307 |
Dan Gohman | f2f6ce6 | 2009-09-11 18:01:28 +0000 | [diff] [blame] | 2 | ; RUN: opt < %s -simplify-libcalls -instcombine -S > %t |
Chandler Carruth | 4177e6f | 2012-07-02 12:47:22 +0000 | [diff] [blame] | 3 | ; RUN: grep "@str,.*i64 3" %t |
| 4 | ; RUN: grep "@str1,.*i64 7" %t |
| 5 | ; RUN: grep "ret i8.*null" %t |
Reid Spencer | 894cfff | 2007-04-15 05:16:38 +0000 | [diff] [blame] | 6 | ; END. |
Chris Lattner | 3d2e54b | 2007-04-06 23:36:59 +0000 | [diff] [blame] | 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 | |