summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-08-19 19:03:07 +0000
committerSanjay Patel <spatel@rotateright.com>2016-08-19 19:03:07 +0000
commit7a104615c527e9d962027988b89e2fc08fd0e257 (patch)
treef4a67e9df68aa22aa46efbcdfc88954099ce1a56 /llvm/lib
parent46d396041bb2d8cdce8ad3a8cca074a59c3716b0 (diff)
downloadbcm5719-llvm-7a104615c527e9d962027988b89e2fc08fd0e257.tar.gz
bcm5719-llvm-7a104615c527e9d962027988b89e2fc08fd0e257.zip
[InstCombine] remove an icmp fold that is already handled by InstSimplify
Specifically, this is done near the end of "SimplifyICmpInst" using computeKnownBits() as the broader solution. There are even vector tests (yay!) for this in test/Transforms/InstSimplify/compare.ll. I considered putting an assert here instead of just deleting, but then we could assert every possible fold in InstSimplify in InstCombine, so...less is more? llvm-svn: 279300
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp10
1 files changed, 0 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 25587739806..f9a7eb2a512 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2009,16 +2009,6 @@ Instruction *InstCombiner::foldICmpShlConstant(ICmpInst &Cmp, Instruction *Shl,
ICmpInst::Predicate Pred = Cmp.getPredicate();
Value *X = Shl->getOperand(0);
if (Cmp.isEquality()) {
- // If we are comparing against bits always shifted out, the comparison
- // cannot succeed.
- Constant *Comp =
- ConstantExpr::getShl(ConstantExpr::getLShr(RHS, ShAmt), ShAmt);
- if (Comp != RHS) { // Comparing against a bit that we know is zero.
- bool IsICMP_NE = Pred == ICmpInst::ICMP_NE;
- Constant *Cst = Builder->getInt1(IsICMP_NE);
- return replaceInstUsesWith(Cmp, Cst);
- }
-
// If the shift is NUW, then it is just shifting out zeros, no need for an
// AND.
if (cast<BinaryOperator>(Shl)->hasNoUnsignedWrap())
OpenPOWER on IntegriCloud