[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Feb 12 22:09:19 PST 2006
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.432 -> 1.433
---
Log message:
Be careful not to request or look at bits shifted in from outside the size
of the input. This fixes the mediabench/gsm/toast failure last night.
---
Diffs of the changes: (+9 -3)
InstructionCombining.cpp | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.432 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.433
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.432 Sun Feb 12 02:07:37 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 13 00:09:08 2006
@@ -939,20 +939,26 @@
// Compute the new bits that are at the top now.
uint64_t HighBits = (1ULL << ShAmt)-1;
HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShAmt;
-
+ uint64_t TypeMask = I->getType()->getIntegralTypeMask();
if (I->getType()->isUnsigned()) { // Unsigned shift right.
- if (SimplifyDemandedBits(I->getOperand(0), DemandedMask << ShAmt,
+ if (SimplifyDemandedBits(I->getOperand(0),
+ (DemandedMask << ShAmt) & TypeMask,
KnownZero, KnownOne, Depth+1))
return true;
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
+ KnownZero &= TypeMask;
+ KnownOne &= TypeMask;
KnownZero >>= ShAmt;
KnownOne >>= ShAmt;
KnownZero |= HighBits; // high bits known zero.
} else { // Signed shift right.
- if (SimplifyDemandedBits(I->getOperand(0), DemandedMask << ShAmt,
+ if (SimplifyDemandedBits(I->getOperand(0),
+ (DemandedMask << ShAmt) & TypeMask,
KnownZero, KnownOne, Depth+1))
return true;
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
+ KnownZero &= TypeMask;
+ KnownOne &= TypeMask;
KnownZero >>= SA->getValue();
KnownOne >>= SA->getValue();
More information about the llvm-commits
mailing list