From: Florian Hahn Date: Wed, 6 Dec 2017 19:47:24 +0000 (+0000) Subject: [InlineFunction] Only replace call if there are VarArgs to forward. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bcd8a152c24df22700d486b3c9fd54b88d91aa8;p=llvm [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319947 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 15a8bf22922..c69ff12b6b9 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -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 Params(CI->arg_operands()); Params.append(VarArgsToForward.begin(), VarArgsToForward.end()); CallInst *Call = CallInst::Create(CI->getCalledFunction(), Params, "", CI);