diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-12-10 06:39:02 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-12-10 06:39:02 +0000 |
| commit | ccd14566e2df8335e5c9bfc75ca6cf31673db6b0 (patch) | |
| tree | 5f051a876e90cc72e2d0f67b3a40c40003448f09 /llvm/lib | |
| parent | d5af8ae17fae996749658e9be46e8122798760e8 (diff) | |
| download | bcm5719-llvm-ccd14566e2df8335e5c9bfc75ca6cf31673db6b0.tar.gz bcm5719-llvm-ccd14566e2df8335e5c9bfc75ca6cf31673db6b0.zip | |
Add arg_begin() and arg_end() to CallInst and InvokeInst; NFCI
- This simplifies the CallSite class, arg_begin / arg_end are now
simple wrapper getters.
- In several places, we were creating CallSite instances solely to call
arg_begin and arg_end. With this change, that's no longer required.
llvm-svn: 255226
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/Instructions.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/PruneEH.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 3 |
4 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 6ec2e289970..f185caacdf6 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -299,8 +299,7 @@ CallInst::CallInst(const CallInst &CI) CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB, Instruction *InsertPt) { - CallSite CS(CI); - std::vector<Value *> Args(CS.arg_begin(), CS.arg_end()); + std::vector<Value *> Args(CI->arg_begin(), CI->arg_end()); auto *NewCI = CallInst::Create(CI->getCalledValue(), Args, OpB, CI->getName(), InsertPt); @@ -587,8 +586,7 @@ InvokeInst::InvokeInst(const InvokeInst &II) InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB, Instruction *InsertPt) { - CallSite CS(II); - std::vector<Value *> Args(CS.arg_begin(), CS.arg_end()); + std::vector<Value *> Args(II->arg_begin(), II->arg_end()); auto *NewII = InvokeInst::Create(II->getCalledValue(), II->getNormalDest(), II->getUnwindDest(), Args, OpB, diff --git a/llvm/lib/Transforms/IPO/PruneEH.cpp b/llvm/lib/Transforms/IPO/PruneEH.cpp index c9c0b197eae..cd2411ba554 100644 --- a/llvm/lib/Transforms/IPO/PruneEH.cpp +++ b/llvm/lib/Transforms/IPO/PruneEH.cpp @@ -191,8 +191,7 @@ bool PruneEH::SimplifyFunction(Function *F) { for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) if (II->doesNotThrow() && canSimplifyInvokeNoUnwind(F)) { - CallSite CS(II); - SmallVector<Value*, 8> Args(CS.arg_begin(), CS.arg_end()); + SmallVector<Value*, 8> Args(II->arg_begin(), II->arg_end()); SmallVector<OperandBundleDef, 1> OpBundles; II->getOperandBundlesAsDefs(OpBundles); diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 9a0aabc38a5..cafd1818fed 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -206,11 +206,10 @@ HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB, BasicBlock *UnwindEdge) { BB->getInstList().pop_back(); // Create the new invoke instruction. - ImmutableCallSite CS(CI); - SmallVector<Value*, 8> InvokeArgs(CS.arg_begin(), CS.arg_end()); + SmallVector<Value*, 8> InvokeArgs(CI->arg_begin(), CI->arg_end()); SmallVector<OperandBundleDef, 1> OpBundles; - CS.getOperandBundlesAsDefs(OpBundles); + CI->getOperandBundlesAsDefs(OpBundles); // Note: we're round tripping operand bundles through memory here, and that // can potentially be avoided with a cleverer API design that we do not have diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 19122dd21a7..391ed685766 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1210,8 +1210,7 @@ static void changeToUnreachable(Instruction *I, bool UseLLVMTrap) { /// changeToCall - Convert the specified invoke into a normal call. static void changeToCall(InvokeInst *II) { - CallSite CS(II); - SmallVector<Value*, 8> Args(CS.arg_begin(), CS.arg_end()); + SmallVector<Value*, 8> Args(II->arg_begin(), II->arg_end()); SmallVector<OperandBundleDef, 1> OpBundles; II->getOperandBundlesAsDefs(OpBundles); CallInst *NewCall = CallInst::Create(II->getCalledValue(), Args, OpBundles, |

