From: Craig Topper Date: Fri, 28 Apr 2017 16:57:55 +0000 (+0000) Subject: [ValueTracking] Use APInt::isSubsetOf and APInt::intersects. NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b08a076cbf5b8ab7596a8a505404ab1d4dde8667;p=llvm [ValueTracking] Use APInt::isSubsetOf and APInt::intersects. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301654 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index aeb8fcfc2b1..2f3b1139ac0 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -1162,12 +1162,12 @@ static void computeKnownBitsFromOperator(const Operator *I, KnownBits &Known, // If the first operand is non-negative or has all low bits zero, then // the upper bits are all zero. - if (Known2.Zero.isSignBitSet() || ((Known2.Zero & LowBits) == LowBits)) + if (Known2.Zero.isSignBitSet() || 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.isSignBitSet() && ((Known2.One & LowBits) != 0)) + if (Known2.One.isSignBitSet() && LowBits.intersects(Known2.One)) Known.One |= ~LowBits; assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");