[libcxx-commits] [clang] [libcxx] Elide suspension points via [[clang::coro_await_suspend_destroy]] (PR #152623)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 8 17:25:31 PDT 2025
snarkmaster wrote:
Thanks for the initial review! I'm glad you like the idea. I'll finish polishing the e2e test, and address your inline comments 1-by-1 above.
> split out libcxx change
Okay, I'll do that for the next update, no problem.
> ... can cover https://github.com/llvm/llvm-project/issues/148380, right?
For the trivial example of `void await_suspend(auto handle) { handle.destroy(); }`, yes, the user could use the new attribute.
But, I think it's possible to have coros that **conditionally** destroy the passed-in handle. So, if the user had something more complicated (e.g. coro that returns a handle, that also destroys the current coro), then my thing wouldn't help.
> Could you have a test for this?
My current IR test verifies that there's no heap alloc across a few examples. Were you thinking of a different kind of test? Can you be very specific since I'm totally new to LLVM?
> if you want, may be you can implement similar attributes to not invoke AwaitSuspend intrinsic in different conditions.
I don't know when I'll next be able to make time to work on this, but if I do, my next target would be `std::suspend_never`. I hope this one could be done without an attribute, though. Do you have other use-cases in mind?
https://github.com/llvm/llvm-project/pull/152623
More information about the libcxx-commits
mailing list