Changes in directory llvm/lib/Transforms/Utils:
CodeExtractor.cpp updated: 1.49 -> 1.50 InlineFunction.cpp updated: 1.52 -> 1.53 LowerInvoke.cpp updated: 1.53 -> 1.54 SimplifyCFG.cpp updated: 1.116 -> 1.117 --- Log message: Eliminate use of ctors that take vectors. --- Diffs of the changes: (+23 -19) CodeExtractor.cpp | 2 +- InlineFunction.cpp | 4 +++- LowerInvoke.cpp | 24 ++++++++++++------------ SimplifyCFG.cpp | 12 +++++++----- 4 files changed, 23 insertions(+), 19 deletions(-) Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.49 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.50 --- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.49 Mon Feb 5 17:32:05 2007 +++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Mon Feb 12 20:10:56 2007 @@ -403,7 +403,7 @@ } // Emit the call to the function - CallInst *call = new CallInst(newFunction, params, + CallInst *call = new CallInst(newFunction, ¶ms[0], params.size(), NumExitBlocks > 1 ? "targetBlock" : ""); codeReplacer->getInstList().push_back(call); Index: llvm/lib/Transforms/Utils/InlineFunction.cpp diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.52 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.53 --- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.52 Fri Feb 2 18:08:31 2007 +++ llvm/lib/Transforms/Utils/InlineFunction.cpp Mon Feb 12 20:10:56 2007 @@ -19,6 +19,7 @@ #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/CallSite.h" using namespace llvm; @@ -80,9 +81,10 @@ // Next, create the new invoke instruction, inserting it at the end // of the old basic block. + SmallVector<Value*, 8> InvokeArgs(CI->op_begin()+1, CI->op_end()); InvokeInst *II = new InvokeInst(CI->getCalledValue(), Split, InvokeDest, - std::vector<Value*>(CI->op_begin()+1, CI->op_end()), + &InvokeArgs[0], InvokeArgs.size(), CI->getName(), BB->getTerminator()); II->setCallingConv(CI->getCallingConv()); Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.53 llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.54 --- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.53 Mon Feb 12 16:56:41 2007 +++ llvm/lib/Transforms/Utils/LowerInvoke.cpp Mon Feb 12 20:10:56 2007 @@ -189,21 +189,21 @@ createAbortMessage(IB->getParent()->getParent()->getParent()); // These are the arguments we WANT... - std::vector<Value*> Args; - Args.push_back(ConstantInt::get(Type::Int32Ty, 2)); - Args.push_back(AbortMessage); - Args.push_back(ConstantInt::get(Type::Int32Ty, AbortMessageLength)); - (new CallInst(WriteFn, Args, "", IB))->setTailCall(); + Value* Args[3]; + Args[0] = ConstantInt::get(Type::Int32Ty, 2); + Args[1] = AbortMessage; + Args[2] = ConstantInt::get(Type::Int32Ty, AbortMessageLength); + (new CallInst(WriteFn, Args, 3, "", IB))->setTailCall(); } bool LowerInvoke::insertCheapEHSupport(Function &F) { bool Changed = false; for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) { + std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end()); // Insert a normal call instruction... CallInst *NewCall = new CallInst(II->getCalledValue(), - std::vector<Value*>(II->op_begin()+3, - II->op_end()), "", II); + &CallArgs[0], CallArgs.size(), "", II); NewCall->takeName(II); NewCall->setCallingConv(II->getCallingConv()); II->replaceAllUsesWith(NewCall); @@ -223,7 +223,7 @@ writeAbortMessage(UI); // Insert a call to abort() - (new CallInst(AbortFn, std::vector<Value*>(), "", UI))->setTailCall(); + (new CallInst(AbortFn, "", UI))->setTailCall(); // Insert a return instruction. This really should be a "barrier", as it // is unreachable. @@ -258,9 +258,9 @@ CatchSwitch->addCase(InvokeNoC, II->getUnwindDest()); // Insert a normal call instruction. + std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end()); CallInst *NewCall = new CallInst(II->getCalledValue(), - std::vector<Value*>(II->op_begin()+3, - II->op_end()), "", + &CallArgs[0], CallArgs.size(), "", II); NewCall->takeName(II); NewCall->setCallingConv(II->getCallingConv()); @@ -533,7 +533,7 @@ Idx.push_back(ConstantInt::get(Type::Int32Ty, 0)); Idx[0] = new GetElementPtrInst(BufPtr, &Idx[0], 2, "JmpBuf", UnwindBlock); Idx[1] = ConstantInt::get(Type::Int32Ty, 1); - new CallInst(LongJmpFn, Idx, "", UnwindBlock); + new CallInst(LongJmpFn, &Idx[0], Idx.size(), "", UnwindBlock); new UnreachableInst(UnwindBlock); // Set up the term block ("throw without a catch"). @@ -543,7 +543,7 @@ writeAbortMessage(TermBlock->getTerminator()); // Insert a call to abort() - (new CallInst(AbortFn, std::vector<Value*>(), "", + (new CallInst(AbortFn, "", TermBlock->getTerminator()))->setTailCall(); Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.116 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.117 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.116 Sat Feb 10 19:37:51 2007 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Mon Feb 12 20:10:56 2007 @@ -21,6 +21,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/ADT/SmallVector.h" #include <algorithm> #include <functional> #include <set> @@ -1369,9 +1370,9 @@ Pred->getInstList().remove(II); // Take out of symbol table // Insert the call now... - std::vector<Value*> Args(II->op_begin()+3, II->op_end()); - CallInst *CI = new CallInst(II->getCalledValue(), Args, - II->getName(), BI); + SmallVector<Value*,8> Args(II->op_begin()+3, II->op_end()); + CallInst *CI = new CallInst(II->getCalledValue(), + &Args[0], Args.size(), II->getName(), BI); CI->setCallingConv(II->getCallingConv()); // If the invoke produced a value, the Call now does instead II->replaceAllUsesWith(CI); @@ -1741,8 +1742,9 @@ II->removeFromParent(); // Take out of symbol table // Insert the call now... - std::vector<Value*> Args(II->op_begin()+3, II->op_end()); - CallInst *CI = new CallInst(II->getCalledValue(), Args, + SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end()); + CallInst *CI = new CallInst(II->getCalledValue(), + &Args[0], Args.size(), II->getName(), BI); CI->setCallingConv(II->getCallingConv()); // If the invoke produced a value, the Call does now instead. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits