[clang] [Clang][Coroutines] Improve GRO handling to better fit scopes and cleanups (PR #66706)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 19 19:16:31 PDT 2023


ChuanqiXu9 wrote:

> Can you point me to such defect? I had no luck searching for it.

It should be https://github.com/llvm/llvm-project/issues/49843. I didn't expect that it was not marked as coroutines. Besides fixing that bug, it is also a minor optimization to not include GRO in coroutine frames.

> Also, what do you mean by "patch be covered"? I'm confused.

When I say "patch be covered", I mean the problem may be solved automatically if we can force the GRO not living on the coroutine frames.

> How do you suggest we do so? Even if we teach the optimizers to not touch the GRO (e.g. -O0) there's still a correctness issue. The generated code is still wrong, given that currently, the lifetime of __coro_gro outlives the __promise, but accessing the proxy for delayed conversion might still depend on the promise.

By forcing the GRO not living on the coroutine frames, it shouldn't be a problem if the lifetime of `__coro_gro` outlives the `__promise`. The only limit is that the initialization of `__coro_gro` should be in the lifetime of `__promise`.




https://github.com/llvm/llvm-project/pull/66706


More information about the cfe-commits mailing list