[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jun 16 18:29:39 PDT 2005
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.352 -> 1.353
---
Log message:
avoid constructing out of range shift amounts.
---
Diffs of the changes: (+4 -2)
InstructionCombining.cpp | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.352 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.353
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.352 Wed Jun 15 23:55:52 2005
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Jun 16 20:29:28 2005
@@ -2511,8 +2511,10 @@
if (!CanFold) {
// To test for the bad case of the signed shr, see if any
// of the bits shifted in could be tested after the mask.
- Constant *OShAmt = ConstantUInt::get(Type::UByteTy,
- Ty->getPrimitiveSizeInBits()-ShAmt->getValue());
+ int ShAmtVal = Ty->getPrimitiveSizeInBits()-ShAmt->getValue();
+ if (ShAmtVal < 0) ShAmtVal = 0; // Out of range shift.
+
+ Constant *OShAmt = ConstantUInt::get(Type::UByteTy, ShAmtVal);
Constant *ShVal =
ConstantExpr::getShl(ConstantInt::getAllOnesValue(Ty), OShAmt);
if (ConstantExpr::getAnd(ShVal, AndCST)->isNullValue())
More information about the llvm-commits
mailing list