[PATCH] D157070: [C++20] [Coroutines] Introduce `@llvm.coro.opt.blocker` to block the may-be-incorrect optimization for awaiter
John McCall via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 10:48:42 PDT 2023
rjmccall added a comment.
Let me try to rephrase to see if I understand the problem here. In the coroutine function, the frontend allocates the awaiter object as a temporary like any other, i.e. with just an `alloca`. The optimizer doesn't see any escapes of that `alloca`, so it thinks it can freely optimize accesses to it. But in fact the awaiter object does escape and can be accessed separately somehow, so the proposed fix is just to emit a call which looks like an escape of the pointer.
I don't really understand how the awaiter object escapes here — how is it possible to access it given just a `std::coroutine_handle`? But given that it apparently does escape, the proposed fix seems like the best way to record that.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157070/new/
https://reviews.llvm.org/D157070
More information about the llvm-commits
mailing list