diff options
| author | Meador Inge <meadori@codesourcery.com> | 2012-10-13 16:45:37 +0000 |
|---|---|---|
| committer | Meador Inge <meadori@codesourcery.com> | 2012-10-13 16:45:37 +0000 |
| commit | 174185084c2d7c8d7ef8762cdb3125ece6376ed0 (patch) | |
| tree | 231ca43e394f46a96384e6b2e67c8c68e543bb82 /llvm/test/Transforms/SimplifyLibCalls | |
| parent | 7fb2f7378bc2675baeaae9020b09ad3897da5bc5 (diff) | |
| download | bcm5719-llvm-174185084c2d7c8d7ef8762cdb3125ece6376ed0.tar.gz bcm5719-llvm-174185084c2d7c8d7ef8762cdb3125ece6376ed0.zip | |
instcombine: Migrate strchr and strrchr optimizations
This patch migrates the strchr and strrchr optimizations from the
simplify-libcalls pass into the instcombine library call simplifier.
llvm-svn: 165875
Diffstat (limited to 'llvm/test/Transforms/SimplifyLibCalls')
| -rw-r--r-- | llvm/test/Transforms/SimplifyLibCalls/StrChr.ll | 26 | ||||
| -rw-r--r-- | llvm/test/Transforms/SimplifyLibCalls/StrRChr.ll | 23 |
2 files changed, 0 insertions, 49 deletions
diff --git a/llvm/test/Transforms/SimplifyLibCalls/StrChr.ll b/llvm/test/Transforms/SimplifyLibCalls/StrChr.ll deleted file mode 100644 index eaabeb2feb8..00000000000 --- a/llvm/test/Transforms/SimplifyLibCalls/StrChr.ll +++ /dev/null @@ -1,26 +0,0 @@ -; Test that the StrChrOptimizer works correctly -; RUN: opt < %s -simplify-libcalls -S | FileCheck %s - -; This transformation requires the pointer size, as it assumes that size_t is -; the size of a pointer. -target datalayout = "-p:64:64:64" - -@hello = constant [14 x i8] c"hello world\5Cn\00" -@null = constant [1 x i8] zeroinitializer - -declare i8* @strchr(i8*, i32) - -define i32 @foo(i32 %index) { - %hello_p = getelementptr [14 x i8]* @hello, i32 0, i32 0 - %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 - %world = call i8* @strchr(i8* %hello_p, i32 119) -; CHECK: getelementptr i8* %hello_p, i64 6 - %ignore = call i8* @strchr(i8* %null_p, i32 119) -; CHECK-NOT: call i8* strchr - %null = call i8* @strchr(i8* %hello_p, i32 0) -; CHECK: getelementptr i8* %hello_p, i64 13 - %result = call i8* @strchr(i8* %hello_p, i32 %index) -; CHECK: call i8* @memchr(i8* %hello_p, i32 %index, i64 14) - ret i32 %index -} - diff --git a/llvm/test/Transforms/SimplifyLibCalls/StrRChr.ll b/llvm/test/Transforms/SimplifyLibCalls/StrRChr.ll deleted file mode 100644 index 2259fc0289f..00000000000 --- a/llvm/test/Transforms/SimplifyLibCalls/StrRChr.ll +++ /dev/null @@ -1,23 +0,0 @@ -; Test that the StrRChrOptimizer works correctly -; RUN: opt < %s -simplify-libcalls -S | FileCheck %s - -target datalayout = "-p:64:64:64" - -@hello = constant [14 x i8] c"hello world\5Cn\00" -@null = constant [1 x i8] zeroinitializer - -declare i8* @strrchr(i8*, i32) - -define void @foo(i8* %bar) { - %hello_p = getelementptr [14 x i8]* @hello, i32 0, i32 0 - %null_p = getelementptr [1 x i8]* @null, i32 0, i32 0 - %world = call i8* @strrchr(i8* %hello_p, i32 119) -; CHECK: getelementptr i8* %hello_p, i64 6 - %ignore = call i8* @strrchr(i8* %null_p, i32 119) -; CHECK-NOT: call i8* strrchr - %null = call i8* @strrchr(i8* %hello_p, i32 0) -; CHECK: getelementptr i8* %hello_p, i64 13 - %strchr = call i8* @strrchr(i8* %bar, i32 0) -; CHECK: call i8* @strchr(i8* %bar, i32 0) - ret void -} |

