summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/strncmp-1.ll
diff options
context:
space:
mode:
authorMeador Inge <meadori@codesourcery.com>2012-11-11 05:11:20 +0000
committerMeador Inge <meadori@codesourcery.com>2012-11-11 05:11:20 +0000
commitbb51ec8b62c2819882b82a2510bf4df6f459bd51 (patch)
treedf5b7dc662ea28fb25dd4030a6fec6ac8659af08 /test/Transforms/InstCombine/strncmp-1.ll
parent6e1591a5d5fba3bde66e3ffd4dd73edd6b94cecf (diff)
downloadllvm-bb51ec8b62c2819882b82a2510bf4df6f459bd51.tar.gz
llvm-bb51ec8b62c2819882b82a2510bf4df6f459bd51.tar.bz2
llvm-bb51ec8b62c2819882b82a2510bf4df6f459bd51.tar.xz
instcombine: Migrate memcmp optimizations
This patch migrates the memcmp optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167683 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/strncmp-1.ll')
-rw-r--r--test/Transforms/InstCombine/strncmp-1.ll10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/Transforms/InstCombine/strncmp-1.ll b/test/Transforms/InstCombine/strncmp-1.ll
index 48b26d1a5f..187c2fa50e 100644
--- a/test/Transforms/InstCombine/strncmp-1.ll
+++ b/test/Transforms/InstCombine/strncmp-1.ll
@@ -67,12 +67,14 @@ define i32 @test5() {
}
; strncmp(x,y,1) -> memcmp(x,y,1)
-; TODO: Once the memcmp simplifier gets moved into the instcombine pass
-; the following memcmp will be folded into two loads and a subtract.
define i32 @test6(i8* %str1, i8* %str2) {
; CHECK: @test6
-; CHECK: call i32 @memcmp
-; CHECK: ret i32 %memcmp
+; CHECK: [[LOAD1:%[a-z]+]] = load i8* %str1, align 1
+; CHECK: [[ZEXT1:%[a-z]+]] = zext i8 [[LOAD1]] to i32
+; CHECK: [[LOAD2:%[a-z]+]] = load i8* %str2, align 1
+; CHECK: [[ZEXT2:%[a-z]+]] = zext i8 [[LOAD2]] to i32
+; CHECK: [[RET:%[a-z]+]] = sub i32 [[ZEXT1]], [[ZEXT2]]
+; CHECK: ret i32 [[RET]]
%temp1 = call i32 @strncmp(i8* %str1, i8* %str2, i32 1)
ret i32 %temp1