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 | 95d25d39d070029128397204289e51e39cbc3d86 (patch) | |
| tree | 33fe910b6d7e5ef8bad7713eabf8ff1f79142b9c /llvm/lib | |
| parent | ad66526ede74d6c064dca30c0c2bc4cc2622b284 (diff) | |
| download | bcm5719-llvm-95d25d39d070029128397204289e51e39cbc3d86.tar.gz bcm5719-llvm-95d25d39d070029128397204289e51e39cbc3d86.zip | |
Avoid setting bits that aren't demanded.
llvm-svn: 47098
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3ec60cde9d7..e5ccd321756 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/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, |

