[clang] [llvm] [Coroutines] Use destroy slot for CoroElide resume fallthrough (PR #207799)
Yuxuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 20 21:14:47 PDT 2026
yuxuanchen1997 wrote:
> > > Got it. Lowering coro.free with the delete contionally sounds a little bit raw but may be acceptable.
> >
> >
> > There's a part that's even less elegant. Apparently the only way I can tell if a `.resume` function is passed with a frame setup with a noalloc ramp function is through checking whether destroy slot is the same pointer as cleanup.
>
> Sorry, I didn't understand. Could you elaborate?
Sure. The .resume function takes a coroutine frame ptr. That ptr may be allocated on the heap or the stack, the resume function is normally oblivious to that.
`coro.free` is a special case. The older set of passes can deterministically rewrite it. However, with [[clang::coro_await_elidable]], we can no longer rewrite coro.free statically in `.resume` functions, its value has to be conditioned on whether the frame was allocated or not. This information is not previously known in the resume function.
https://github.com/llvm/llvm-project/pull/207799
More information about the llvm-commits
mailing list