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
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 6ec2e28..f185caa 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -299,8 +299,7 @@
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::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,