[llvm] r300093 - [InstCombine] Remove unreachable code for turning an And where all demanded bits on both sides are known to be zero into a constant 0.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 12:08:04 PDT 2017


Author: ctopper
Date: Wed Apr 12 14:08:03 2017
New Revision: 300093

URL: http://llvm.org/viewvc/llvm-project?rev=300093&view=rev
Log:
[InstCombine] Remove unreachable code for turning an And where all demanded bits on both sides are known to be zero into a constant 0.

We already handled a superset check that included the known ones too and folded to a constant that may include ones. But it can also handle the case of no ones.


Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp?rev=300093&r1=300092&r2=300093&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Wed Apr 12 14:08:03 2017
@@ -195,10 +195,6 @@ Value *InstCombiner::SimplifyDemandedUse
         (DemandedMask & ~RHSKnownZero))
       return I->getOperand(1);
 
-    // If all of the demanded bits in the inputs are known zeros, return zero.
-    if ((DemandedMask & (RHSKnownZero|LHSKnownZero)) == DemandedMask)
-      return Constant::getNullValue(VTy);
-
     // If the RHS is a constant, see if we can simplify it.
     if (ShrinkDemandedConstant(I, 1, DemandedMask & ~LHSKnownZero))
       return I;




More information about the llvm-commits mailing list