[llvm] 8a19842 - [InstCombine] delete redundant folds; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 11:23:56 PDT 2022


Author: Sanjay Patel
Date: 2022-08-30T14:21:29-04:00
New Revision: 8a19842c0ee8701300e1c96b9709308e2cf340c3

URL: https://github.com/llvm/llvm-project/commit/8a19842c0ee8701300e1c96b9709308e2cf340c3
DIFF: https://github.com/llvm/llvm-project/commit/8a19842c0ee8701300e1c96b9709308e2cf340c3.diff

LOG: [InstCombine] delete redundant folds; NFC

InstSimplify does this via isKnownNonEqual(), so it's already
using knownbits on these patterns and trying other folds.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index ecf9e3ebcff96..cf144dd919b51 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -1029,13 +1029,6 @@ Instruction *InstCombinerImpl::transformZExtICmp(ICmpInst *Cmp, ZExtInst &Zext)
       APInt KnownZeroMask(~Known.Zero);
       if (KnownZeroMask.isPowerOf2()) { // Exactly 1 possible 1?
         bool isNE = Cmp->getPredicate() == ICmpInst::ICMP_NE;
-        if (!Op1CV->isZero() && (*Op1CV != KnownZeroMask)) {
-          // (X&4) == 2 --> false
-          // (X&4) != 2 --> true
-          Constant *Res = ConstantInt::get(Zext.getType(), isNE);
-          return replaceInstUsesWith(Zext, Res);
-        }
-
         uint32_t ShAmt = KnownZeroMask.logBase2();
         Value *In = Cmp->getOperand(0);
         if (ShAmt) {


        


More information about the llvm-commits mailing list