do not set realloc() as NotAlias, since it can return the same pointer. This whole...
[oota-llvm.git] / test / Transforms / SimplifyLibCalls / StrPBrk.ll
1 ; RUN: opt < %s -simplify-libcalls -S | FileCheck %s
2
3 target datalayout = "-p:64:64:64"
4
5 @hello = constant [12 x i8] c"hello world\00"
6 @w = constant [2 x i8] c"w\00"
7 @null = constant [1 x i8] zeroinitializer
8
9 declare i8* @strpbrk(i8*, i8*)
10
11 define void @test(i8* %s1, i8* %s2) {
12         %hello_p = getelementptr [12 x i8]* @hello, i32 0, i32 0
13         %w_p = getelementptr [2 x i8]* @w, i32 0, i32 0
14         %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0
15         %test1 = call i8* @strpbrk(i8* %null_p, i8* %s2)
16         %test2 = call i8* @strpbrk(i8* %s1, i8* %null_p)
17 ; CHECK-NOT: call i8* @strpbrk
18         %test3 = call i8* @strpbrk(i8* %s1, i8* %w_p)
19 ; CHECK: call i8* @strchr(i8* %s1, i32 119)
20         %test4 = call i8* @strpbrk(i8* %hello_p, i8* %w_p)
21 ; CHECK: getelementptr i8* %hello_p, i64 6
22         %test5 = call i8* @strpbrk(i8* %s1, i8* %s2)
23 ; CHECK: call i8* @strpbrk(i8* %s1, i8* %s2)
24         ret void
25 }