]> granicus.if.org Git - llvm/commitdiff
[InstSimplify] Use APInt::isMaxSignedValue() instead of comparing with ~APInt::getSig...
authorCraig Topper <craig.topper@gmail.com>
Thu, 30 Mar 2017 22:10:54 +0000 (22:10 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 30 Mar 2017 22:10:54 +0000 (22:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299120 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/InstructionSimplify.cpp

index 08afafa74573a292a45a3dca19214f63a139006e..dace55a1c0907f3ce9a9815cd86b912c2fca4de4 100644 (file)
@@ -703,7 +703,7 @@ static Value *SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
     APInt KnownZero(BitWidth, 0);
     APInt KnownOne(BitWidth, 0);
     computeKnownBits(Op1, KnownZero, KnownOne, Q.DL, 0, Q.AC, Q.CxtI, Q.DT);
-    if (KnownZero == ~APInt::getSignBit(BitWidth)) {
+    if (KnownZero.isMaxSignedValue()) {
       // Op1 is either 0 or the minimum signed value. If the sub is NSW, then
       // Op1 must be 0 because negating the minimum signed value is undefined.
       if (isNSW)