[llvm] r309887 - [InstCombine] Remove unnecessary temporary APInt. NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 14:05:41 PDT 2017


Author: ctopper
Date: Wed Aug  2 14:05:40 2017
New Revision: 309887

URL: http://llvm.org/viewvc/llvm-project?rev=309887&view=rev
Log:
[InstCombine] Remove unnecessary temporary APInt. NFCI

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=309887&r1=309886&r2=309887&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Wed Aug  2 14:05:40 2017
@@ -527,11 +527,6 @@ Value *InstCombiner::SimplifyDemandedUse
       Known.Zero.lshrInPlace(ShiftAmt);
       Known.One.lshrInPlace(ShiftAmt);
 
-      // Handle the sign bits.
-      APInt SignMask(APInt::getSignMask(BitWidth));
-      // Adjust to where it is now in the mask.
-      SignMask.lshrInPlace(ShiftAmt);
-
       // If the input sign bit is known to be zero, or if none of the top bits
       // are demanded, turn this into an unsigned shift right.
       assert(BitWidth > ShiftAmt && "Shift amount not saturated?");
@@ -541,7 +536,7 @@ Value *InstCombiner::SimplifyDemandedUse
                                                           I->getOperand(1));
         LShr->setIsExact(cast<BinaryOperator>(I)->isExact());
         return InsertNewInstWith(LShr, *I);
-      } else if (Known.One.intersects(SignMask)) { // New bits are known one.
+      } else if (Known.One[BitWidth-ShiftAmt-1]) { // New bits are known one.
         Known.One |= HighBits;
       }
     }




More information about the llvm-commits mailing list