[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Zhou Sheng
zhousheng00 at gmail.com
Wed Mar 7 21:42:17 PST 2007
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.650 -> 1.651
---
Log message:
Fix a bug in APIntified ComputeMaskedBits().
---
Diffs of the changes: (+4 -8)
InstructionCombining.cpp | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.650 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.651
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.650 Wed Mar 7 19:52:58 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Mar 7 23:42:00 2007
@@ -675,11 +675,9 @@
case Instruction::ZExt: {
// Compute the bits in the result that are not present in the input.
const IntegerType *SrcTy = cast<IntegerType>(I->getOperand(0)->getType());
- APInt NotIn(~SrcTy->getMask());
- APInt NewBits = APInt::getAllOnesValue(BitWidth) &
- NotIn.zext(BitWidth);
+ APInt NewBits(APInt::getAllOnesValue(BitWidth).shl(SrcTy->getBitWidth()));
- Mask &= ~NotIn;
+ Mask &= SrcTy->getMask().zext(BitWidth);
ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
// The top bits are known to be zero.
@@ -689,11 +687,9 @@
case Instruction::SExt: {
// Compute the bits in the result that are not present in the input.
const IntegerType *SrcTy = cast<IntegerType>(I->getOperand(0)->getType());
- APInt NotIn(~SrcTy->getMask());
- APInt NewBits = APInt::getAllOnesValue(BitWidth) &
- NotIn.zext(BitWidth);
+ APInt NewBits(APInt::getAllOnesValue(BitWidth).shl(SrcTy->getBitWidth()));
- Mask &= ~NotIn;
+ Mask &= SrcTy->getMask().zext(BitWidth);
ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1);
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
More information about the llvm-commits
mailing list