]> granicus.if.org Git - llvm/commitdiff
[InlineFunction] Only replace call if there are VarArgs to forward.
authorFlorian Hahn <florian.hahn@arm.com>
Wed, 6 Dec 2017 19:47:24 +0000 (19:47 +0000)
committerFlorian Hahn <florian.hahn@arm.com>
Wed, 6 Dec 2017 19:47:24 +0000 (19:47 +0000)
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

lib/Transforms/Utils/InlineFunction.cpp

index 15a8bf229224cd20f035d12378242b0703d945a7..c69ff12b6b9940e039001c823794e7973775bea0 100644 (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);