blob: 8e9f2062cded42611a48f06bab40df8e8c269f59 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; PR1307
Dan Gohman3c7d3082009-09-11 18:01:28 +00002; RUN: opt < %s -simplify-libcalls -instcombine -S > %t
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003; 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
12define 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
17declare i8* @strchr(i8*, i32)
18
19define 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
24define i8* @test3() {
25entry:
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