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

Chris Lattner sabre at nondot.org
Wed Jan 31 12:09:11 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

IndVarSimplify.cpp updated: 1.107 -> 1.108
InstructionCombining.cpp updated: 1.617 -> 1.618
LowerGC.cpp updated: 1.19 -> 1.20
---
Log message:

remove temporary vectors.


---
Diffs of the changes:  (+9 -13)

 IndVarSimplify.cpp       |    3 +--
 InstructionCombining.cpp |    4 ++--
 LowerGC.cpp              |   15 ++++++---------
 3 files changed, 9 insertions(+), 13 deletions(-)


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.107 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.108
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.107	Tue Jan 30 22:40:53 2007
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp	Wed Jan 31 14:08:52 2007
@@ -197,8 +197,7 @@
         std::string Name = PN->getName(); PN->setName("");
         Value *PreInc =
           new GetElementPtrInst(PN->getIncomingValue(PreheaderIdx),
-                                std::vector<Value*>(1, NewPhi), Name,
-                                InsertPos);
+                                NewPhi, Name, InsertPos);
         PN->replaceAllUsesWith(PreInc);
       }
 


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.617 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.618
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.617	Wed Jan 31 12:09:17 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Wed Jan 31 14:08:52 2007
@@ -6418,8 +6418,8 @@
 
       // If we found a path from the src to dest, create the getelementptr now.
       if (SrcElTy == DstElTy) {
-        std::vector<Value*> Idxs(NumZeros+1, ZeroUInt);
-        return new GetElementPtrInst(Src, Idxs);
+        SmallVector<Value*, 8> Idxs(NumZeros+1, ZeroUInt);
+        return new GetElementPtrInst(Src, &Idxs[0], Idxs.size());
       }
     }
   }


Index: llvm/lib/Transforms/Scalar/LowerGC.cpp
diff -u llvm/lib/Transforms/Scalar/LowerGC.cpp:1.19 llvm/lib/Transforms/Scalar/LowerGC.cpp:1.20
--- llvm/lib/Transforms/Scalar/LowerGC.cpp:1.19	Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/Scalar/LowerGC.cpp	Wed Jan 31 14:08:52 2007
@@ -229,10 +229,7 @@
   Constant *One  = ConstantInt::get(Type::Int32Ty, 1);
 
   // Get a pointer to the prev pointer.
-  std::vector<Value*> Par;
-  Par.push_back(Zero);
-  Par.push_back(Zero);
-  Value *PrevPtrPtr = new GetElementPtrInst(AI, Par, "prevptrptr", IP);
+  Value *PrevPtrPtr = new GetElementPtrInst(AI, Zero, Zero, "prevptrptr", IP);
 
   // Load the previous pointer.
   Value *PrevPtr = new LoadInst(RootChain, "prevptr", IP);
@@ -240,12 +237,12 @@
   new StoreInst(PrevPtr, PrevPtrPtr, IP);
 
   // Set the number of elements in this record.
-  Par[1] = ConstantInt::get(Type::Int32Ty, 1);
-  Value *NumEltsPtr = new GetElementPtrInst(AI, Par, "numeltsptr", IP);
+  Value *NumEltsPtr = new GetElementPtrInst(AI, Zero, One, "numeltsptr", IP);
   new StoreInst(ConstantInt::get(Type::Int32Ty, GCRoots.size()), NumEltsPtr,IP);
 
+  Value* Par[4];
+  Par[0] = Zero;
   Par[1] = ConstantInt::get(Type::Int32Ty, 2);
-  Par.resize(4);
 
   const PointerType *PtrLocTy =
     cast<PointerType>(GCRootInt->getFunctionType()->getParamType(0));
@@ -256,13 +253,13 @@
     // Initialize the meta-data pointer.
     Par[2] = ConstantInt::get(Type::Int32Ty, i);
     Par[3] = One;
-    Value *MetaDataPtr = new GetElementPtrInst(AI, Par, "MetaDataPtr", IP);
+    Value *MetaDataPtr = new GetElementPtrInst(AI, Par, 4, "MetaDataPtr", IP);
     assert(isa<Constant>(GCRoots[i]->getOperand(2)) && "Must be a constant");
     new StoreInst(GCRoots[i]->getOperand(2), MetaDataPtr, IP);
 
     // Initialize the root pointer to null on entry to the function.
     Par[3] = Zero;
-    Value *RootPtrPtr = new GetElementPtrInst(AI, Par, "RootEntPtr", IP);
+    Value *RootPtrPtr = new GetElementPtrInst(AI, Par, 4, "RootEntPtr", IP);
     new StoreInst(Null, RootPtrPtr, IP);
 
     // Each occurrance of the llvm.gcroot intrinsic now turns into an






More information about the llvm-commits mailing list