summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-02-29 01:46:50 +0000
committerBill Wendling <isanbard@gmail.com>2012-02-29 01:46:50 +0000
commitf2c78f344e56b4571072560ca07cf7dbe88654c9 (patch)
tree5449c9f7ec66e833bec3714895a7335833617f94 /llvm/lib
parent9e821456a354807c098cdea25b649c2b02dfa1ba (diff)
downloadbcm5719-llvm-f2c78f344e56b4571072560ca07cf7dbe88654c9.tar.gz
bcm5719-llvm-f2c78f344e56b4571072560ca07cf7dbe88654c9.zip
Restrict this transformation to equality conditions.
This transformation is not correct for not-equal conditions: (trunc x) != C1 & (and x, CA) != C2 -> (and x, CA|CMAX) != C1|C2 Let C1 == 0 C2 == 0 CA == 0xFF0000 CMAX == 0xFF and truncating to i8. The original truth table: x | A: trunc x != 0 | B: x & 0xFF0000 != 0 | A & B != 0 -------------------------------------------------------------- 0x00000 | 0 | 0 | 0 0x00001 | 1 | 0 | 0 0x10000 | 0 | 1 | 0 0x10001 | 1 | 1 | 1 The truth table of the replacement: x | x & 0xFF00FF != 0 ---------------------------- 0x00000 | 0 0x00001 | 1 0x10000 | 1 0x10001 | 1 So they are different. llvm-svn: 151691
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 7cb56f8fe69..cc8f5bf43e5 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -753,7 +753,7 @@ Value *InstCombiner::FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS) {
// (trunc x) == C1 & (and x, CA) == C2 -> (and x, CA|CMAX) == C1|C2
// where CMAX is the all ones value for the truncated type,
// iff the lower bits of C2 and CA are zero.
- if (LHSCC == RHSCC && ICmpInst::isEquality(LHSCC) &&
+ if (LHSCC == ICmpInst::ICMP_EQ && LHSCC == RHSCC &&
LHS->hasOneUse() && RHS->hasOneUse()) {
Value *V;
ConstantInt *AndCst, *SmallCst = 0, *BigCst = 0;
OpenPOWER on IntegriCloud