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

Reid Kleckner rnk at google.com
Fri Apr 18 12:51:12 PDT 2014


ping


On Wed, Apr 16, 2014 at 2:59 PM, Reid Kleckner <rnk at google.com> wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140418/c0c3a0d3/attachment.html>


More information about the llvm-commits mailing list