aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp11
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp8
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp34
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp6
-rw-r--r--lib/Transforms/Instrumentation/ProfilingUtils.cpp3
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp5
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp4
-rw-r--r--lib/Transforms/Scalar/LowerGC.cpp6
-rw-r--r--lib/Transforms/Utils/CodeExtractor.cpp2
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp4
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp24
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp12
12 files changed, 60 insertions, 59 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 86f3f74..7036a01 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -161,7 +161,8 @@ static bool IsAlwaysValidPointer(Value *V) {
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 @@ Function *ArgPromotion::DoPromotion(Function *F,
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 @@ Function *ArgPromotion::DoPromotion(Function *F,
// 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.
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 5963c9e..d0dbc8b 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -169,10 +169,10 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
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 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
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();
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index fcaa4e8..3f32c0c 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -259,8 +259,7 @@ void LowerSetJmp::TransformLongJmpCall(CallInst* Inst)
// 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 @@ AllocaInst* LowerSetJmp::GetSetJmpMap(Function* Func)
// 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 @@ LowerSetJmp::SwitchValuePair LowerSetJmp::GetSJSwitch(Function* Func,
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 @@ LowerSetJmp::SwitchValuePair LowerSetJmp::GetSJSwitch(Function* Func,
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 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst)
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 @@ void LowerSetJmp::visitCallInst(CallInst& CI)
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 @@ void LowerSetJmp::visitInvokeInst(InvokeInst& II)
// 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 @@ void LowerSetJmp::visitInvokeInst(InvokeInst& II)
// 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() {
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index 271a8fa..6040379 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -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 @@ bool PruneEH::SimplifyFunction(Function *F) {
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());
diff --git a/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/lib/Transforms/Instrumentation/ProfilingUtils.cpp
index d003f6c..071ca0d 100644
--- a/lib/Transforms/Instrumentation/ProfilingUtils.cpp
+++ b/lib/Transforms/Instrumentation/ProfilingUtils.cpp
@@ -53,7 +53,8 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
}
Args[3] = ConstantInt::get(Type::Int32Ty, NumElements);
- Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos);
+ Instruction *InitCall = new CallInst(InitFn, &Args[0], Args.size(),
+ "newargc", InsertPos);
// If argc or argv are not available in main, just pass null values in.
Function::arg_iterator AI;
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 20e4367..3946f57 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -25,6 +25,7 @@
#include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/DepthFirstIterator.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Compiler.h"
@@ -188,8 +189,8 @@ bool ADCE::doADCE() {
if (AA.onlyReadsMemory(F)) {
// The function cannot unwind. Convert it to a call with a branch
// after it to the normal destination.
- std::vector<Value*> Args(II->op_begin()+3, II->op_end());
- CallInst *NewCall = new CallInst(F, Args, "", II);
+ SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end());
+ CallInst *NewCall = new CallInst(F, &Args[0], Args.size(), "", II);
NewCall->takeName(II);
NewCall->setCallingConv(II->getCallingConv());
II->replaceAllUsesWith(NewCall);
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 556c054..5782260 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7352,10 +7352,10 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
Instruction *NC;
if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
NC = new InvokeInst(Callee, II->getNormalDest(), II->getUnwindDest(),
- Args, Caller->getName(), Caller);
+ &Args[0], Args.size(), Caller->getName(), Caller);
cast<InvokeInst>(II)->setCallingConv(II->getCallingConv());
} else {
- NC = new CallInst(Callee, Args, Caller->getName(), Caller);
+ NC = new CallInst(Callee, &Args[0], Args.size(), Caller->getName(), Caller);
if (cast<CallInst>(Caller)->isTailCall())
cast<CallInst>(NC)->setTailCall();
cast<CallInst>(NC)->setCallingConv(cast<CallInst>(Caller)->getCallingConv());
diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp
index 20636d4..c10849e 100644
--- a/lib/Transforms/Scalar/LowerGC.cpp
+++ b/lib/Transforms/Scalar/LowerGC.cpp
@@ -314,10 +314,10 @@ bool LowerGC::runOnFunction(Function &F) {
NewBB->getInstList().remove(CI);
// Create a new invoke instruction.
+ std::vector<Value*> Args(CI->op_begin()+1, CI->op_end());
+
Value *II = new InvokeInst(CI->getCalledValue(), NewBB, Cleanup,
- std::vector<Value*>(CI->op_begin()+1,
- CI->op_end()),
- CI->getName(), CBB);
+ &Args[0], Args.size(), CI->getName(), CBB);
CI->replaceAllUsesWith(II);
delete CI;
}
diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp
index 87a2868..f304df2 100644
--- a/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/lib/Transforms/Utils/CodeExtractor.cpp
@@ -403,7 +403,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer,
}
// Emit the call to the function
- CallInst *call = new CallInst(newFunction, params,
+ CallInst *call = new CallInst(newFunction, &params[0], params.size(),
NumExitBlocks > 1 ? "targetBlock" : "");
codeReplacer->getInstList().push_back(call);
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 054c1c7..07194e3 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -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 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
// 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());
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index 5a4408f..d89cc95 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -189,21 +189,21 @@ void LowerInvoke::writeAbortMessage(Instruction *IB) {
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 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) {
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 @@ void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
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 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
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 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
writeAbortMessage(TermBlock->getTerminator());
// Insert a call to abort()
- (new CallInst(AbortFn, std::vector<Value*>(), "",
+ (new CallInst(AbortFn, "",
TermBlock->getTerminator()))->setTailCall();
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index b3a9f1d..92b0a9d 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -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 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
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 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
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.