diff options
author | Adrian Vogelsgesang <avogelsgesang@salesforce.com> | 2025-10-09 08:31:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-09 17:31:44 +0200 |
commit | c4f36758b73fbf651650d8b650347e0ac172795f (patch) | |
tree | cb11aa4aea15e6b6c7ef251d66754485fc5e3b71 /libcxx/test/std/thread/thread.jthread/swap.free.pass.cpp | |
parent | a03aef4faedb06ac0a70846dc4deeffd0ee4bff0 (diff) | |
download | llvm-main.zip llvm-main.tar.gz llvm-main.tar.bz2 |
Unconditionally eliding all `[[clang::coro_await_elidable]]` coroutines
is not good.
For example,
```
Task bar();
Task foo(bool b) {
if (b) [[unlikely]] {
co_await bar();
}
}
```
Assume Task is marked with `[[clang::coro_await_elidable]]`, now we will
always elide the call to `bar()` into the frame of `foo()`. But this may
be a regression instead of an optimization if `b` is always false.
This patch tries to mitigate the problem by leveraging hot/cold
information. This can be optimized further in the future but at least
this patch makes things better.
This patch was originally written by ChuanqiXu9 (#145831), but stalled
during PR review because the diagnostics were not integrated with
the existing optimization remarks. I rebased the original patch,
integrated it with the optimization remarks, and did a couple of smaller
cosmetic changes (e.g., made the test case expectations more
targeted, etc.)
Co-Authored-by: Chuanqi Xu <yedeng.yd@linux.alibaba.com>
Diffstat (limited to 'libcxx/test/std/thread/thread.jthread/swap.free.pass.cpp')
0 files changed, 0 insertions, 0 deletions