[libcxx-commits] [clang] [libcxx] Elide suspension points via [[clang::coro_await_suspend_destroy]] (PR #152623)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 10 00:54:56 PDT 2025


snarkmaster wrote:

> ... can cover https://github.com/llvm/llvm-project/issues/148380, right?

Above, I mentioned "> `await_suspend` that destroys the coro returns a handle"  as one of the cases I don't cover.

There's no logical reason this couldn't be supported, but I only needed `void` for short-circuiting coros. 

I looked through `folly/coro` and found a destroying suspend that returned a handle (see [`DetachedBarrierTask`](https://github.com/facebook/folly/blob/main/folly/coro/detail/BarrierTask.h#L147)). I then made a [quick-and-dirty PoC](https://gist.github.com/snarkmaster/f85ad34dcd0b0f3a810685fc5379948e) of a compiler change to support returning handles from `await_suspend_destroy`. Unfortunately, it didn't make an obvious difference to the code optimization in this case.

So, I don't think the current PR should include the extra code to support `await_suspend_destroy` returning handles. We'd need to see some kind of use-case where it makes a meaningful difference to perf, and a reason why making that optimize the normal way is hard.

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


More information about the libcxx-commits mailing list