[all-commits] [llvm/llvm-project] 20e651: [Coroutines] Mark 'coroutine_handle<>::address' as...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Mon Aug 28 23:35:59 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 20e6515d5c5ff155a54e10f64caef1c76d8d5976
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-08-29 (Tue, 29 Aug 2023)

  Changed paths:
    M clang/lib/Sema/SemaCoroutine.cpp
    A clang/test/CodeGenCoroutines/pr65054.cpp

  Log Message:
  [Coroutines] Mark 'coroutine_handle<>::address' as always-inline

Close https://github.com/llvm/llvm-project/issues/65054

The direct issue is still the call to coroutine_handle<>::address()
after await_suspend(). Without optimizations, the current logic will put
the temporary result of await_suspend() to the coroutine frame since the
middle end feel the temporary is escaped from
coroutine_handle<>::address. To fix this fundamentally, we should wrap
the whole logic about await-suspend into a standalone function. See

And as a short-term workaround, we probably can mark
coroutine_handle<>::address() as always-inline so that the temporary
result may not be thought to be escaped then it won't be put on the
coroutine frame. Although it looks dirty, it is probably do-able since
the compiler are allowed to do special tricks to standard library

More information about the All-commits mailing list