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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 16:30:12 PDT 2018


rnk added a comment.

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

> How long does this pointer live?


I'd say it belongs to the callee. It's argument memory (maybe rinsed through registers on some targets) in the new call frame. Some targets allocate it in the caller's frame, but it should only live as long as the call is active, and TCO would fail in codegen for such a case.

> 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'd say each byval arg is a new memory allocation. It could have the same address as the old allocation, but that's not relevant.

> 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?

We could probably mark it nocapture, and that'd probably fix it.


Repository:
  rL LLVM

https://reviews.llvm.org/D52895





More information about the llvm-commits mailing list