[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri May 7 10:36:04 PDT 2004
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.198 -> 1.199
---
Log message:
Fix PR336: http://llvm.cs.uiuc.edu/PR336 : The instcombine pass asserts when visiting load instruction
---
Diffs of the changes: (+3 -2)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.198 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.199
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.198 Tue May 4 10:19:33 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri May 7 10:35:56 2004
@@ -887,7 +887,7 @@
// if so, convert to a bitwise and.
if (ConstantUInt *C = dyn_cast<ConstantUInt>(RHS))
if (uint64_t Val = C->getValue()) // Don't break X % 0 (divide by zero)
- if (!(Val & Val-1)) // Power of 2
+ if (!(Val & (Val-1))) // Power of 2
return BinaryOperator::create(Instruction::And, I.getOperand(0),
ConstantUInt::get(I.getType(), Val-1));
}
@@ -2869,7 +2869,8 @@
if (const PointerType *SrcTy =
dyn_cast<PointerType>(CI->getOperand(0)->getType())) {
const Type *SrcPTy = SrcTy->getElementType();
- if (TD->getTypeSize(SrcPTy) == TD->getTypeSize(DestPTy) &&
+ if (SrcPTy->isSized() && DestPTy->isSized() &&
+ TD->getTypeSize(SrcPTy) == TD->getTypeSize(DestPTy) &&
(SrcPTy->isInteger() || isa<PointerType>(SrcPTy)) &&
(DestPTy->isInteger() || isa<PointerType>(DestPTy))) {
// Okay, we are casting from one integer or pointer type to another of
More information about the llvm-commits
mailing list