[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 00:18:55 PDT 2025


snarkmaster wrote:

@ChuanqiXu9,

(1) I'm not actually changing `libc++`. I just added an end-to-end test for this compiler feature. It's backwards- and forwards-compatible, so I don't think there's any risk to bundling it with this PR.

(2) My patch isn't a fully general solution to https://github.com/llvm/llvm-project/issues/148380. Rather, it's a (probably) better solution to the more narrow class of problems of short-circuiting suspends.

To use my thing, two things have to be true:
 - You actually have to opt into the new attribute and define `await_suspend_destroy` to get the perf benefits.
 -  You can only do so if your `await_suspend` would destroy the coro **unconditionally**.

When both of those are true (opt-in & unconditional deestroy), it results in a much simpler compilation setup -- HALO, less IR, less optimized code, better perf.


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


More information about the libcxx-commits mailing list