[PATCH] D104007: [BasicAA] Properly mark that coroutine suspension may modify parameters

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 22:23:59 PDT 2021


efriedma added a comment.

In D104007#2812395 <https://reviews.llvm.org/D104007#2812395>, @lxfind wrote:

> In D104007#2812383 <https://reviews.llvm.org/D104007#2812383>, @efriedma wrote:
>
>> This doesn't seem right.  A byval argument is essentially a local variable.  We should treat it the same way as we would an alloca.  If it's live across the first suspend point, it should become part of the coroutine frame.
>
> It will become part of the coroutine frame, by copying it through memcpy. That's actually what's the first memcpy for in the test case.

I don't understand.  As far as I can tell, the destination of both memcpys in the testcase are allocas.

> But the parameter pointer itself will still die during a coroutine suspension. Because of that I would say the parameter pointer is different from an alloca pointer, because during a coroutine suspension, allocas won't change.

I think we're talking past each other.

During coroutine suspension, allocas won't change because corosplit rewrites them.  I'm saying that the same rewrite should apply to byval arguments.  A byval argument is basically the same thing as an alloca: it's memory owned by the callee that's deallocated when the function returns.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104007/new/

https://reviews.llvm.org/D104007



More information about the llvm-commits mailing list