[PATCH] D157070: [C++20] [Coroutines] Introduce `@llvm.coro.opt.blocker` to block the may-be-incorrect optimization for awaiter

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 22:41:38 PDT 2023

ChuanqiXu planned changes to this revision.
ChuanqiXu added a comment.

Thanks for your valuable input. It pretty makes sense. I'll try to mark `await_suspend` as `no inline` as a (temporary) solution.

> That isn't all that coro.save has to do — it also has to make sure that spills are written into the frame. And in fact there's a subtle thing with that I'm not sure we're getting right, which again comes back to the special behavior of await_suspend and the ways our representation choices defy ordinary IR semantics.

This is the key point that I agree to mark `await_suspend` as `noinline` now. Since currently we didn't implement the semantics for coro.save "it also has to make sure that spills are written into the frame" actually. Currently the `coro.save` intrinsic will take the coroutine handle as the first argument to make the coroutine handle as escaped. But the problem is, ..., other optimizations don't know other local variables may be alias with other local variables. So the problem you described is possible. Then I think this is the real root cause of the issue. Thanks for your insight again.



More information about the llvm-commits mailing list