[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 24 11:21:28 PST 2025
rnk wrote:
Re: sroa/mem2reg, that's a valid concern with Hans's intrinsic approach.
> So it's not really a question of "improving" the existing algorithm; we need markers in the IR, like coro_outside_frame, and the algorithm should be based on that.
To check my understanding, by explicit markers, you mean first class fields of `AllocaInst`, like the `inalloca` bit, right?
----
Going back to the beginning, why do we end up in a UAF situation? IIUC, the ramp function should do the following:
- store the bytes of the trivial abi argument into an alloca
- call the move ctor into the coro frame
- co_return
- destroy the coro frame objects, matching the move ctor call
- destroy the alloca, matching the construction from earlier in the caller
What is coro split doing that breaks this? It sounds like it's rewriting the second destructor to destroy the variable in the frame, but that's incorrect.
I guess the issue is that the coroutine frame is not modelled in IR during frontend lowering. It's implied that all allocas get moved into the frame, except in two cases, apparently.
What's different between the case where we suspend and the case where there are no suspend points?
https://github.com/llvm/llvm-project/pull/127653
More information about the cfe-commits
mailing list