]> granicus.if.org Git - llvm/commitdiff
[SelectionDAG] Use APInt::isSubsetOf/intersects to simplify some code.
authorCraig Topper <craig.topper@intel.com>
Thu, 1 Aug 2019 06:06:21 +0000 (06:06 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 1 Aug 2019 06:06:21 +0000 (06:06 +0000)
Also use KnownBits::isNegative/isNonNegative to further simplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367518 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 2520de49efb6f2c8fea5eb3b038c03650763cba9..2143fef6adcb9e8d5e52b390b2c289f6d41acc95 100644 (file)
@@ -3090,12 +3090,12 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
 
         // If the first operand is non-negative or has all low bits zero, then
         // the upper bits are all zero.
-        if (Known2.Zero[BitWidth-1] || ((Known2.Zero & LowBits) == LowBits))
+        if (Known2.isNonNegative() || LowBits.isSubsetOf(Known2.Zero))
           Known.Zero |= ~LowBits;
 
         // If the first operand is negative and not all low bits are zero, then
         // the upper bits are all one.
-        if (Known2.One[BitWidth-1] && ((Known2.One & LowBits) != 0))
+        if (Known2.isNegative() && LowBits.intersects(Known2.One))
           Known.One |= ~LowBits;
         assert((Known.Zero & Known.One) == 0&&"Bits known to be one AND zero?");
       }