From 7a104615c527e9d962027988b89e2fc08fd0e257 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Fri, 19 Aug 2016 19:03:07 +0000 Subject: [PATCH] [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 --- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 2558773..f9a7eb2 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(Shl)->hasNoUnsignedWrap()) -- 2.7.4