diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-09-29 23:52:12 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-09-29 23:52:12 +0000 |
commit | 05f585e28bc579a93c978068eb979acf98e991ff (patch) | |
tree | 5e8d459820c0f2a9b1a82fc99cb9849ecfa64c4e /test/Transforms/SimplifyLibCalls | |
parent | 28815c4b64f3c29934ec3d9c48c91d8c1bd97682 (diff) | |
download | external_llvm-05f585e28bc579a93c978068eb979acf98e991ff.zip external_llvm-05f585e28bc579a93c978068eb979acf98e991ff.tar.gz external_llvm-05f585e28bc579a93c978068eb979acf98e991ff.tar.bz2 |
Add strpbrk folding to SimplifyLibCalls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SimplifyLibCalls')
-rw-r--r-- | test/Transforms/SimplifyLibCalls/StrPBrk.ll | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyLibCalls/StrPBrk.ll b/test/Transforms/SimplifyLibCalls/StrPBrk.ll new file mode 100644 index 0000000..29c3b74 --- /dev/null +++ b/test/Transforms/SimplifyLibCalls/StrPBrk.ll @@ -0,0 +1,25 @@ +; RUN: opt < %s -simplify-libcalls -S | FileCheck %s + +target datalayout = "-p:64:64:64" + +@hello = constant [12 x i8] c"hello world\00" +@w = constant [2 x i8] c"w\00" +@null = constant [1 x i8] zeroinitializer + +declare i8* @strpbrk(i8*, i8*) + +define void @test(i8* %s1, i8* %s2) { + %hello_p = getelementptr [12 x i8]* @hello, i32 0, i32 0 + %w_p = getelementptr [2 x i8]* @w, i32 0, i32 0 + %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 + %test1 = call i8* @strpbrk(i8* %null_p, i8* %s2) + %test2 = call i8* @strpbrk(i8* %s1, i8* %null_p) +; CHECK-NOT: call i8* @strpbrk + %test3 = call i8* @strpbrk(i8* %s1, i8* %w_p) +; CHECK: call i8* @strchr(i8* %s1, i32 119) + %test4 = call i8* @strpbrk(i8* %hello_p, i8* %w_p) +; CHECK: getelementptr i8* %hello_p, i64 6 + %test5 = call i8* @strpbrk(i8* %s1, i8* %s2) +; CHECK: call i8* @strpbrk(i8* %s1, i8* %s2) + ret void +} |