Changes in directory llvm/lib/Transforms/IPO:

ArgumentPromotion.cpp updated: 1.37 -> 1.38
DeadArgumentElimination.cpp updated: 1.39 -> 1.40
LowerSetJmp.cpp updated: 1.39 -> 1.40
PruneEH.cpp updated: 1.30 -> 1.31
---
Log message:

Eliminate use of ctors that take vectors.


---
Diffs of the changes:  (+27 -32)

 ArgumentPromotion.cpp       |   11 ++++++-----
 DeadArgumentElimination.cpp |    8 ++++----
 LowerSetJmp.cpp             |   34 ++++++++++++++--------------------
 PruneEH.cpp                 |    6 +++---
 4 files changed, 27 insertions(+), 32 deletions(-)


Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.37 
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.38
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.37  Mon Feb 12 16:56:41 2007
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp       Mon Feb 12 20:10:56 2007
@@ -161,7 +161,8 @@
 static bool AllCalleesPassInValidPointerForArgument(Argument *Arg) {
   Function *Callee = Arg->getParent();
 
-  unsigned ArgNo = std::distance(Callee->arg_begin(), 
Function::arg_iterator(Arg));
+  unsigned ArgNo = std::distance(Callee->arg_begin(),
+                                 Function::arg_iterator(Arg));
 
   // Look at all call sites of the function.  At this pointer we know we only
   // have direct callees.
@@ -442,10 +443,10 @@
     Instruction *New;
     if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
       New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(),
-                           Args, "", Call);
+                           &Args[0], Args.size(), "", Call);
       cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
     } else {
-      New = new CallInst(NF, Args, "", Call);
+      New = new CallInst(NF, &Args[0], Args.size(), "", Call);
       cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
       if (cast<CallInst>(Call)->isTailCall())
         cast<CallInst>(New)->setTailCall();
@@ -474,8 +475,8 @@
   // Loop over the argument list, transfering uses of the old arguments over to
   // the new arguments, also transfering over the names as well.
   //
-  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), I2 = 
NF->arg_begin();
-       I != E; ++I)
+  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(),
+       I2 = NF->arg_begin(); I != E; ++I)
     if (!ArgsToPromote.count(I)) {
       // If this is an unmodified argument, move the name and users over to the
       // new version.


Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.39 
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.40
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.39    Sat Feb 10 
19:08:35 2007
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon Feb 12 20:10:56 2007
@@ -169,10 +169,10 @@
     Instruction *New;
     if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
       New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(),
-                           Args, "", Call);
+                           &Args[0], Args.size(), "", Call);
       cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
     } else {
-      New = new CallInst(NF, Args, "", Call);
+      New = new CallInst(NF, &Args[0], Args.size(), "", Call);
       cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
       if (cast<CallInst>(Call)->isTailCall())
         cast<CallInst>(New)->setTailCall();
@@ -535,10 +535,10 @@
     Instruction *New;
     if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
       New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(),
-                           Args, "", Call);
+                           &Args[0], Args.size(), "", Call);
       cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
     } else {
-      New = new CallInst(NF, Args, "", Call);
+      New = new CallInst(NF, &Args[0], Args.size(), "", Call);
       cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
       if (cast<CallInst>(Call)->isTailCall())
         cast<CallInst>(New)->setTailCall();


Index: llvm/lib/Transforms/IPO/LowerSetJmp.cpp
diff -u llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.39 
llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.40
--- llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.39        Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/IPO/LowerSetJmp.cpp     Mon Feb 12 20:10:56 2007
@@ -259,8 +259,7 @@
   // Inst's uses and doesn't get a name.
   CastInst* CI = 
     new BitCastInst(Inst->getOperand(1), SBPTy, "LJBuf", Inst);
-  new CallInst(ThrowLongJmp, make_vector<Value*>(CI, Inst->getOperand(2), 0),
-               "", Inst);
+  new CallInst(ThrowLongJmp, CI, Inst->getOperand(2), "", Inst);
 
   SwitchValuePair& SVP = SwitchValMap[Inst->getParent()->getParent()];
 
@@ -303,7 +302,7 @@
   // Fill in the alloca and call to initialize the SJ map.
   const Type *SBPTy = PointerType::get(Type::Int8Ty);
   AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst);
-  new CallInst(InitSJMap, make_vector<Value*>(Map, 0), "", Inst);
+  new CallInst(InitSJMap, Map, "", Inst);
   return SJMap[Func] = Map;
 }
 
@@ -340,8 +339,7 @@
   PrelimBBMap[Func] = LongJmpPre;
 
   // Grab the exception.
-  CallInst* Cond = new
-    CallInst(IsLJException, std::vector<Value*>(), "IsLJExcept");
+  CallInst* Cond = new CallInst(IsLJException, "IsLJExcept");
   LongJmpPreIL.push_back(Cond);
 
   // The "decision basic block" gets the number associated with the
@@ -353,10 +351,9 @@
   new BranchInst(DecisionBB, Rethrow, Cond, LongJmpPre);
 
   // Fill in the "decision" basic block.
-  CallInst* LJVal = new CallInst(GetLJValue, std::vector<Value*>(), "LJVal");
+  CallInst* LJVal = new CallInst(GetLJValue, "LJVal");
   DecisionBBIL.push_back(LJVal);
-  CallInst* SJNum = new
-    CallInst(TryCatchLJ, make_vector<Value*>(GetSetJmpMap(Func), 0), "SJNum");
+  CallInst* SJNum = new CallInst(TryCatchLJ, GetSetJmpMap(Func), "SJNum");
   DecisionBBIL.push_back(SJNum);
 
   SwitchInst* SI = new SwitchInst(SJNum, Rethrow, 0, DecisionBB);
@@ -376,11 +373,11 @@
   const Type* SBPTy = PointerType::get(Type::Int8Ty);
   CastInst* BufPtr = 
     new BitCastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst);
-  new CallInst(AddSJToMap,
-               make_vector<Value*>(GetSetJmpMap(Func), BufPtr,
-                                   ConstantInt::get(Type::Int32Ty,
-                                                     SetJmpIDMap[Func]++), 0),
-               "", Inst);
+  std::vector<Value*> Args = 
+    make_vector<Value*>(GetSetJmpMap(Func), BufPtr,
+                        ConstantInt::get(Type::Int32Ty,
+                                         SetJmpIDMap[Func]++), 0);
+  new CallInst(AddSJToMap, &Args[0], Args.size(), "", Inst);
 
   // We are guaranteed that there are no values live across basic blocks
   // (because we are "not in SSA form" yet), but there can still be values live
@@ -470,7 +467,7 @@
   std::vector<Value*> Params(CI.op_begin() + 1, CI.op_end());
   InvokeInst* II = new
     InvokeInst(CI.getCalledValue(), NewBB, PrelimBBMap[Func],
-               Params, CI.getName(), Term);
+               &Params[0], Params.size(), CI.getName(), Term);
 
   // Replace the old call inst with the invoke inst and remove the call.
   CI.replaceAllUsesWith(II);
@@ -504,8 +501,7 @@
 
   // If this is a longjmp exception, then branch to the preliminary BB of
   // the longjmp exception handling. Otherwise, go to the old exception.
-  CallInst* IsLJExcept = new
-    CallInst(IsLJException, std::vector<Value*>(), "IsLJExcept");
+  CallInst* IsLJExcept = new CallInst(IsLJException, "IsLJExcept");
   InstList.push_back(IsLJExcept);
 
   new BranchInst(PrelimBBMap[Func], ExceptBB, IsLJExcept, NewExceptBB);
@@ -518,16 +514,14 @@
 // function.
 void LowerSetJmp::visitReturnInst(ReturnInst &RI) {
   Function* Func = RI.getParent()->getParent();
-  new CallInst(DestroySJMap, make_vector<Value*>(GetSetJmpMap(Func), 0),
-               "", &RI);
+  new CallInst(DestroySJMap, GetSetJmpMap(Func), "", &RI);
 }
 
 // visitUnwindInst - We want to destroy the setjmp map upon exit from the
 // function.
 void LowerSetJmp::visitUnwindInst(UnwindInst &UI) {
   Function* Func = UI.getParent()->getParent();
-  new CallInst(DestroySJMap, make_vector<Value*>(GetSetJmpMap(Func), 0),
-               "", &UI);
+  new CallInst(DestroySJMap, GetSetJmpMap(Func), "", &UI);
 }
 
 ModulePass *llvm::createLowerSetJmpPass() {


Index: llvm/lib/Transforms/IPO/PruneEH.cpp
diff -u llvm/lib/Transforms/IPO/PruneEH.cpp:1.30 
llvm/lib/Transforms/IPO/PruneEH.cpp:1.31
--- llvm/lib/Transforms/IPO/PruneEH.cpp:1.30    Sat Feb 10 19:08:35 2007
+++ llvm/lib/Transforms/IPO/PruneEH.cpp Mon Feb 12 20:10:56 2007
@@ -22,6 +22,7 @@
 #include "llvm/Intrinsics.h"
 #include "llvm/Instructions.h"
 #include "llvm/Analysis/CallGraph.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/Compiler.h"
@@ -144,11 +145,10 @@
     if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
       if (Function *F = II->getCalledFunction())
         if (DoesNotUnwind.count(CG[F])) {
+          SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end());
           // Insert a call instruction before the invoke.
           CallInst *Call = new CallInst(II->getCalledValue(),
-                                        std::vector<Value*>(II->op_begin()+3,
-                                                            II->op_end()),
-                                        "", II);
+                                        &Args[0], Args.size(), "", II);
           Call->takeName(II);
           Call->setCallingConv(II->getCallingConv());
 



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to