[PATCH] D52895: [TailCallElim] Enable marking of calls with byval as tails

Robert Lougher via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 16:49:45 PDT 2018


rob.lougher added a comment.

In https://reviews.llvm.org/D52895#1255911, @nicholas wrote:

> In https://reviews.llvm.org/D52895#1255738, @rnk wrote:
>
> > Nice!
> >
> > In https://reviews.llvm.org/D52895#1255602, @nicholas wrote:
> >
> > > I don't understand the logical model behind byval, but I'll review the change to TRE under the assumption that the goal of the patch is correct.
> >
> >
> > You have to hallucinate an implicit memcpy into the call sequence. Its destination is some stack memory allocated during the call sequence not visible from LLVM IR.
>
>
> How long does this pointer live? In a sequence with two byval calls on the same pointer, can they reuse the same memory, or it is always reallocated even if it happens to have the same address and contents?


I don't think you can think of it as a pointer as some targets may pass it in unused registers. Simply think of it as a copy which can outlive the destruction of the current frame.

> If it is always reallocated, any reason it shouldn't be marked nocapture? And if it were nocapture, we wouldn't need this change, right?

Unfortunately we would still need this change. A nocapture argument is not an escape point but it is still a user of the alloca, which prevents the call from being marked tail.


Repository:
  rL LLVM

https://reviews.llvm.org/D52895





More information about the llvm-commits mailing list