[InlineFunction] Only replace call if there are VarArgs to forward.

Summary:
There is no need to replace the original call instruction if no
 VarArgs need to be forwarded. 

Reviewers: davide, rnk, majnemer, efriedma

Reviewed By: efriedma

Subscribers: eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D40412

llvm-svn: 319947
This commit is contained in:
Florian Hahn 2017-12-06 19:47:24 +00:00
parent 3e069f5724
commit 115d99162c
1 changed files with 2 additions and 1 deletions

View File

@ -1860,7 +1860,8 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
if (MarkNoUnwind)
CI->setDoesNotThrow();
if (ForwardVarArgsTo && CI->getCalledFunction() == ForwardVarArgsTo) {
if (ForwardVarArgsTo && !VarArgsToForward.empty() &&
CI->getCalledFunction() == ForwardVarArgsTo) {
SmallVector<Value*, 6> Params(CI->arg_operands());
Params.append(VarArgsToForward.begin(), VarArgsToForward.end());
CallInst *Call = CallInst::Create(CI->getCalledFunction(), Params, "", CI);