diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-03-18 04:01:29 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-03-18 04:01:29 +0000 |
commit | 3eb0d80de0fb46310b8e6c0b8a059ca86a5b3bc6 (patch) | |
tree | 47a2c7fe9f326bb9d5569e0b29e2f66c11992b7f /llvm/lib | |
parent | ac6081cb672a5d6027b6dbdb8f9ca95aac9f4775 (diff) | |
download | bcm5719-llvm-3eb0d80de0fb46310b8e6c0b8a059ca86a5b3bc6.tar.gz bcm5719-llvm-3eb0d80de0fb46310b8e6c0b8a059ca86a5b3bc6.zip |
[ValueTracking] Add APInt::setSignBit and use it to replace ORing with getSignBit which will malloc if the bit width is larger than 64.
llvm-svn: 298180
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index a3d4198edcb..38d9c290bfc 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -321,11 +321,11 @@ static void computeKnownBitsAddSub(bool Add, const Value *Op0, const Value *Op1, // Adding two non-negative numbers, or subtracting a negative number from // a non-negative one, can't wrap into negative. if (LHSKnownZero.isNegative() && KnownZero2.isNegative()) - KnownZero |= APInt::getSignBit(BitWidth); + KnownZero.setSignBit(); // Adding two negative numbers, or subtracting a non-negative number from // a negative one, can't wrap into non-negative. else if (LHSKnownOne.isNegative() && KnownOne2.isNegative()) - KnownOne |= APInt::getSignBit(BitWidth); + KnownOne.setSignBit(); } } } @@ -732,7 +732,7 @@ static void computeKnownBitsFromAssume(const Value *V, APInt &KnownZero, if (RHSKnownZero.isNegative()) { // We know that the sign bit is zero. - KnownZero |= APInt::getSignBit(BitWidth); + KnownZero.setSignBit(); } // assume(v >_s c) where c is at least -1. } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) && @@ -743,7 +743,7 @@ static void computeKnownBitsFromAssume(const Value *V, APInt &KnownZero, if (RHSKnownOne.isAllOnesValue() || RHSKnownZero.isNegative()) { // We know that the sign bit is zero. - KnownZero |= APInt::getSignBit(BitWidth); + KnownZero.setSignBit(); } // assume(v <=_s c) where c is negative } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) && @@ -754,7 +754,7 @@ static void computeKnownBitsFromAssume(const Value *V, APInt &KnownZero, if (RHSKnownOne.isNegative()) { // We know that the sign bit is one. - KnownOne |= APInt::getSignBit(BitWidth); + KnownOne.setSignBit(); } // assume(v <_s c) where c is non-positive } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) && @@ -765,7 +765,7 @@ static void computeKnownBitsFromAssume(const Value *V, APInt &KnownZero, if (RHSKnownZero.isAllOnesValue() || RHSKnownOne.isNegative()) { // We know that the sign bit is one. - KnownOne |= APInt::getSignBit(BitWidth); + KnownOne.setSignBit(); } // assume(v <=_u c) } else if (match(Arg, m_ICmp(Pred, m_V, m_Value(A))) && |