diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-08-15 21:01:31 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-08-15 21:01:31 +0000 |
| commit | 78db2963f6964b4669c82cf8e6abc408ffe91200 (patch) | |
| tree | 64956be224f5233cb01e458df4fe7381f9eb1281 /llvm/lib | |
| parent | 6107a4195d84279bb71f58b4b7d9b76384b43af0 (diff) | |
| download | bcm5719-llvm-78db2963f6964b4669c82cf8e6abc408ffe91200.tar.gz bcm5719-llvm-78db2963f6964b4669c82cf8e6abc408ffe91200.zip | |
Revert "[ValueTracking] Improve ValueTracking on left shift with nsw flag"
This reverts commit r278172. It causes PR28946.
llvm-svn: 278740
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index bd1c1b9dd5d..41a924390be 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1064,22 +1064,13 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero, } case Instruction::Shl: { // (shl X, C1) & C2 == 0 iff (X & C2 >>u C1) == 0 - bool NSW = cast<OverflowingBinaryOperator>(I)->hasNoSignedWrap(); - auto KZF = [BitWidth, NSW](const APInt &KnownZero, unsigned ShiftAmt) { - APInt KZResult = (KnownZero << ShiftAmt) | + auto KZF = [BitWidth](const APInt &KnownZero, unsigned ShiftAmt) { + return (KnownZero << ShiftAmt) | APInt::getLowBitsSet(BitWidth, ShiftAmt); // Low bits known 0. - // If this shift has "nsw" keyword, then the result is either a poison - // value or has the same sign bit as the first operand. - if (NSW && KnownZero.isNegative()) - KZResult.setBit(BitWidth - 1); - return KZResult; }; - auto KOF = [BitWidth, NSW](const APInt &KnownOne, unsigned ShiftAmt) { - APInt KOResult = KnownOne << ShiftAmt; - if (NSW && KnownOne.isNegative()) - KOResult.setBit(BitWidth - 1); - return KOResult; + auto KOF = [BitWidth](const APInt &KnownOne, unsigned ShiftAmt) { + return KnownOne << ShiftAmt; }; computeKnownBitsFromShiftOperator(I, KnownZero, KnownOne, |

