diff options
author | Dan Gohman <gohman@apple.com> | 2008-02-13 22:43:25 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-02-13 22:43:25 +0000 |
commit | 72d2fd57b67b8afc6ddf6314c483a9d2ec71569a (patch) | |
tree | 9930a1397143fb3c1a009a6748ef41f0737400ce /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | cd2ad1df5d2e0600200c81bc214e0b65ff699c5f (diff) |
Avoid setting bits that aren't demanded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3ec60cde9d..e5ccd32175 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1237,7 +1237,7 @@ void SelectionDAG::ComputeMaskedBits(SDOperand Op, const APInt &Mask, KnownZero = KnownZero.lshr(ShAmt); KnownOne = KnownOne.lshr(ShAmt); - APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt); + APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt) & Mask; KnownZero |= HighBits; // High bits known zero. } return; @@ -1248,8 +1248,8 @@ void SelectionDAG::ComputeMaskedBits(SDOperand Op, const APInt &Mask, APInt InDemandedMask = (Mask << ShAmt); // If any of the demanded bits are produced by the sign extension, we also // demand the input sign bit. - APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt); - if (!!(HighBits & Mask)) + APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt) & Mask; + if (HighBits.getBoolValue()) InDemandedMask |= APInt::getSignBit(BitWidth); ComputeMaskedBits(Op.getOperand(0), InDemandedMask, KnownZero, KnownOne, |