[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Jeff Cohen jeffc at jolt-lang.org
Wed Apr 4 09:59:14 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.729 -> 1.730
---
Log message:

Fix 2007-04-04-BadFoldBitcastIntoMalloc.ll

---
Diffs of the changes:  (+5 -4)

 InstructionCombining.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.729 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.730
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.729	Wed Apr  4 01:42:45 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Wed Apr  4 11:58:57 2007
@@ -5901,7 +5901,7 @@
 /// X*Scale+Offset.
 ///
 static Value *DecomposeSimpleLinearExpr(Value *Val, unsigned &Scale,
-                                        unsigned &Offset) {
+                                        int &Offset) {
   assert(Val->getType() == Type::Int32Ty && "Unexpected allocation size type!");
   if (ConstantInt *CI = dyn_cast<ConstantInt>(Val)) {
     Offset = CI->getZExtValue();
@@ -5985,7 +5985,8 @@
 
   // See if we can satisfy the modulus by pulling a scale out of the array
   // size argument.
-  unsigned ArraySizeScale, ArrayOffset;
+  unsigned ArraySizeScale;
+  int ArrayOffset;
   Value *NumElements = // See if the array size is a decomposable linear expr.
     DecomposeSimpleLinearExpr(AI.getOperand(0), ArraySizeScale, ArrayOffset);
  
@@ -6010,8 +6011,8 @@
     }
   }
   
-  if (unsigned Offset = (AllocElTySize*ArrayOffset)/CastElTySize) {
-    Value *Off = ConstantInt::get(Type::Int32Ty, Offset);
+  if (int Offset = (AllocElTySize*ArrayOffset)/CastElTySize) {
+    Value *Off = ConstantInt::get(Type::Int32Ty, Offset, true);
     Instruction *Tmp = BinaryOperator::createAdd(Amt, Off, "tmp");
     Amt = InsertNewInstBefore(Tmp, AI);
   }






More information about the llvm-commits mailing list