[llvm-commits] CVS: llvm/lib/Transforms/IPO/PoolAllocate.cpp MutateStructTypes.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Sep 13 17:30:13 PDT 2002


Changes in directory llvm/lib/Transforms/IPO:

PoolAllocate.cpp updated: 1.40 -> 1.41
MutateStructTypes.cpp updated: 1.28 -> 1.29

---
Log message:

Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned.



---
Diffs of the changes:

Index: llvm/lib/Transforms/IPO/PoolAllocate.cpp
diff -u llvm/lib/Transforms/IPO/PoolAllocate.cpp:1.40 llvm/lib/Transforms/IPO/PoolAllocate.cpp:1.41
--- llvm/lib/Transforms/IPO/PoolAllocate.cpp:1.40	Thu Aug  8 14:01:21 2002
+++ llvm/lib/Transforms/IPO/PoolAllocate.cpp	Fri Sep 13 17:28:36 2002
@@ -1639,9 +1639,8 @@
            "Pool type should not be abstract anymore!");
 
     // Add an allocation and a free for each pool...
-    AllocaInst *PoolAlloc
-      = new AllocaInst(PointerType::get(PI.PoolType), 0,
-                       CurModule->getTypeName(PI.PoolType));
+    AllocaInst *PoolAlloc = new AllocaInst(PI.PoolType, 0,
+                                           CurModule->getTypeName(PI.PoolType));
     PI.Handle = PoolAlloc;
     EntryNodeInsts.push_back(PoolAlloc);
     AllocationInst *AI = Allocs[i]->getAllocation();


Index: llvm/lib/Transforms/IPO/MutateStructTypes.cpp
diff -u llvm/lib/Transforms/IPO/MutateStructTypes.cpp:1.28 llvm/lib/Transforms/IPO/MutateStructTypes.cpp:1.29
--- llvm/lib/Transforms/IPO/MutateStructTypes.cpp:1.28	Thu Aug 22 18:36:46 2002
+++ llvm/lib/Transforms/IPO/MutateStructTypes.cpp	Fri Sep 13 17:28:36 2002
@@ -399,12 +399,14 @@
         // Memory Instructions
       case Instruction::Alloca:
         NewI = 
-          new AllocaInst(ConvertType(I.getType()),
+          new MallocInst(
+                  ConvertType(cast<PointerType>(I.getType())->getElementType()),
                          I.getNumOperands() ? ConvertValue(I.getOperand(0)) :0);
         break;
       case Instruction::Malloc:
         NewI = 
-          new MallocInst(ConvertType(I.getType()),
+          new MallocInst(
+                  ConvertType(cast<PointerType>(I.getType())->getElementType()),
                          I.getNumOperands() ? ConvertValue(I.getOperand(0)) :0);
         break;
 





More information about the llvm-commits mailing list