[llvm-commits] [parallel] CVS: llvm/lib/Transforms/Scalar/LowerAllocations.cpp SCCP.cpp

Misha Brukman brukman at cs.uiuc.edu
Wed Mar 10 19:35:14 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

LowerAllocations.cpp updated: 1.43.2.1 -> 1.43.2.2
SCCP.cpp updated: 1.88.2.1 -> 1.88.2.2

---
Log message:

Merge from trunk.

---
Diffs of the changes:  (+7 -1)

Index: llvm/lib/Transforms/Scalar/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.43.2.1 llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.43.2.2
--- llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.43.2.1	Mon Mar  1 17:58:16 2004
+++ llvm/lib/Transforms/Scalar/LowerAllocations.cpp	Wed Mar 10 19:34:31 2004
@@ -101,7 +101,7 @@
       Value *MallocArg = ConstantUInt::get(Type::UIntTy, Size);
       if (MI->getNumOperands() && Size == 1) {
         MallocArg = MI->getOperand(0);         // Operand * 1 = Operand
-      } else if (MI->getNumOperands()) {
+      } else if (MI->isArrayAllocation()) {
         // Multiply it by the array size if necessary...
         MallocArg = BinaryOperator::create(Instruction::Mul, MI->getOperand(0),
                                            MallocArg, "", I);


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.88.2.1 llvm/lib/Transforms/Scalar/SCCP.cpp:1.88.2.2
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.88.2.1	Mon Mar  1 17:58:16 2004
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Wed Mar 10 19:34:31 2004
@@ -713,6 +713,12 @@
   if (PtrVal.isUndefined()) return;   // The pointer is not resolved yet!
   if (PtrVal.isConstant() && !I.isVolatile()) {
     Value *Ptr = PtrVal.getConstant();
+    if (isa<ConstantPointerNull>(Ptr)) {
+      // load null -> null
+      markConstant(IV, &I, Constant::getNullValue(I.getType()));
+      return;
+    }
+      
     if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Ptr))
       Ptr = CPR->getValue();
 





More information about the llvm-commits mailing list