summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/icmp.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-09 07:47:06 +0000
committerChris Lattner <sabre@nondot.org>2009-01-09 07:47:06 +0000
commita80d668215be2b9a0f564d85d0506e6a3dbe7ba2 (patch)
treefacc394ce930ad7eb43485039e483c7b437beaa2 /test/Transforms/InstCombine/icmp.ll
parent6d6b4106985378a5b8714dc74b9d7a077eb2471b (diff)
downloadllvm-a80d668215be2b9a0f564d85d0506e6a3dbe7ba2.tar.gz
llvm-a80d668215be2b9a0f564d85d0506e6a3dbe7ba2.tar.bz2
llvm-a80d668215be2b9a0f564d85d0506e6a3dbe7ba2.tar.xz
Implement rdar://6480391, extending of equality icmp's to avoid a truncation.
I noticed this in the code compiled for a routine using std::map, which produced this code: %25 = tail call i32 @memcmp(i8* %24, i8* %23, i32 6) nounwind readonly %.lobit.i = lshr i32 %25, 31 ; <i32> [#uses=1] %tmp.i = trunc i32 %.lobit.i to i8 ; <i8> [#uses=1] %toBool = icmp eq i8 %tmp.i, 0 ; <i1> [#uses=1] br i1 %toBool, label %bb3, label %bb4 which compiled to: call L_memcmp$stub shrl $31, %eax testb %al, %al jne LBB1_11 ## with this change, we compile it to: call L_memcmp$stub testl %eax, %eax js LBB1_11 This triggers all the time in common code, with patters like this: %169 = and i32 %ply, 1 ; <i32> [#uses=1] %170 = trunc i32 %169 to i8 ; <i8> [#uses=1] %toBool = icmp ne i8 %170, 0 ; <i1> [#uses=1] %7 = lshr i32 %6, 24 ; <i32> [#uses=1] %9 = trunc i32 %7 to i8 ; <i8> [#uses=1] %10 = icmp ne i8 %9, 0 ; <i1> [#uses=1] etc git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/icmp.ll')
-rw-r--r--test/Transforms/InstCombine/icmp.ll1
1 files changed, 0 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
index bb69ba3be4..27136d6943 100644
--- a/test/Transforms/InstCombine/icmp.ll
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -1,5 +1,4 @@
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep icmp
-; END.
define i32 @test1(i32 %X) {
entry: