[llvm] r300305 - [InstCombine] Use APInt::setSignBit and APInt::isNegative(). NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 22:09:04 PDT 2017


Author: ctopper
Date: Fri Apr 14 00:09:04 2017
New Revision: 300305

URL: http://llvm.org/viewvc/llvm-project?rev=300305&view=rev
Log:
[InstCombine] Use APInt::setSignBit and APInt::isNegative(). NFC

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=300305&r1=300304&r2=300305&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Fri Apr 14 00:09:04 2017
@@ -571,7 +571,7 @@ Value *InstCombiner::SimplifyDemandedUse
       // If any of the "high bits" are demanded, we should set the sign bit as
       // demanded.
       if (DemandedMask.countLeadingZeros() <= ShiftAmt)
-        DemandedMaskIn.setBit(BitWidth-1);
+        DemandedMaskIn.setSignBit();
 
       // If the shift is exact, then it does demand the low bits (and knows that
       // they are zero).
@@ -629,12 +629,12 @@ Value *InstCombiner::SimplifyDemandedUse
 
         // If LHS is non-negative or has all low bits zero, then the upper bits
         // are all zero.
-        if (LHSKnownZero[BitWidth-1] || ((LHSKnownZero & LowBits) == LowBits))
+        if (LHSKnownZero.isNegative() || ((LHSKnownZero & LowBits) == LowBits))
           KnownZero |= ~LowBits;
 
         // If LHS is negative and not all low bits are zero, then the upper bits
         // are all one.
-        if (LHSKnownOne[BitWidth-1] && ((LHSKnownOne & LowBits) != 0))
+        if (LHSKnownOne.isNegative() && ((LHSKnownOne & LowBits) != 0))
           KnownOne |= ~LowBits;
 
         assert(!(KnownZero & KnownOne) && "Bits known to be one AND zero?");




More information about the llvm-commits mailing list