From: Craig Topper Date: Thu, 30 Mar 2017 22:10:54 +0000 (+0000) Subject: [InstSimplify] Use APInt::isMaxSignedValue() instead of comparing with ~APInt::getSig... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3361f1d2d728de4d6e2203648389136baa5a8c26;p=llvm [InstSimplify] Use APInt::isMaxSignedValue() instead of comparing with ~APInt::getSignBit. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299120 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index 08afafa7457..dace55a1c09 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -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)