[PATCH] Inliner: Don't clear tail flags when creating allocas for byval args

Reid Kleckner rnk at google.com
Wed Apr 16 14:59:20 PDT 2014


Hi chandlerc,

This is essentially a partial revert of r105255, which fixed PR7272.
The test case it introduced[1] still passes:
  test/Transforms/Inline/2010-05-31-ByvalTailcall.ll

I think this was misdiagnosed.  The call to @ext in the test case should
never have been marked 'tail' by instcombine, tailcallelim, or any other
optimization because it captures a byval argument, which is using memory
from the caller.  That's against the LangRef rules for tail calls.  It
looks like the optimization that added the tail flag has been fixed in
the meantime, because the test still passes.

http://reviews.llvm.org/D3403

Files:
  lib/Transforms/Utils/InlineFunction.cpp

Index: lib/Transforms/Utils/InlineFunction.cpp
===================================================================
--- lib/Transforms/Utils/InlineFunction.cpp
+++ lib/Transforms/Utils/InlineFunction.cpp
@@ -586,15 +586,8 @@
       if (CS.isByValArgument(ArgNo)) {
         ActualArg = HandleByValArgument(ActualArg, TheCall, CalledFunc, IFI,
                                         CalledFunc->getParamAlignment(ArgNo+1));
- 
-        // Calls that we inline may use the new alloca, so we need to clear
-        // their 'tail' flags if HandleByValArgument introduced a new alloca and
-        // the callee has calls.
-        if (ActualArg != *AI) {
-          MustClearTailCallFlags = true;
+        if (ActualArg != *AI)
           ByValInit.push_back(std::make_pair(ActualArg, (Value*) *AI));
-        }
-
       }
 
       VMap[I] = ActualArg;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3403.1.patch
Type: text/x-patch
Size: 851 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140416/c9944602/attachment.bin>


More information about the llvm-commits mailing list