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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 02:52:21 PST 2017


fhahn created this revision.
Herald added a subscriber: eraman.

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


https://reviews.llvm.org/D40412

Files:
  lib/Transforms/Utils/InlineFunction.cpp


Index: lib/Transforms/Utils/InlineFunction.cpp
===================================================================
--- lib/Transforms/Utils/InlineFunction.cpp
+++ lib/Transforms/Utils/InlineFunction.cpp
@@ -1859,7 +1859,8 @@
         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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40412.124141.patch
Type: text/x-patch
Size: 715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171124/e0a4e535/attachment.bin>


More information about the llvm-commits mailing list