llvm.org GIT mirror llvm / 3d2e54b
testcase for PR1307 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35705 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 12 years ago
1 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llvm-as < %s | opt -simplify-libcalls -instcombine | llvm-dis > %t &&
1 ; RUN: grep '@str,.*i64 3' %t &&
2 ; RUN: grep '@str1,.*i64 7' %t &&
3 ; RUN: grep 'ret i8.*null' %t
4 ; PR1307
5
6 @str = internal constant [5 x i8] c"foog\00"
7 @str1 = internal constant [8 x i8] c"blahhh!\00"
8 @str2 = internal constant [5 x i8] c"Ponk\00"
9
10 define i8* @test1() {
11 %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; [#uses=1]
12 ret i8* %tmp3
13 }
14
15 declare i8* @strchr(i8*, i32)
16
17 define i8* @test2() {
18 %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; [#uses=1]
19 ret i8* %tmp3
20 }
21
22 define i8* @test3() {
23 entry:
24 %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; [#uses=1]
25 ret i8* %tmp3
26 }
27