[clang] [llvm] [coro] Lower `llvm.coro.await.suspend.handle` to resume with tail call (PR #89751)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 14 09:03:56 PDT 2024
================
@@ -206,14 +210,37 @@ static void lowerAwaitSuspend(IRBuilder<> &Builder, CoroAwaitSuspendInst *CB) {
llvm_unreachable("Unexpected coro_await_suspend invocation method");
}
+ if (CB->getCalledFunction()->getIntrinsicID() ==
+ Intrinsic::coro_await_suspend_handle) {
+ // Follow the await_suspend by a lowered resume call to the returned
+ // coroutine.
+ if (auto *Invoke = dyn_cast<InvokeInst>(CB))
+ Builder.SetInsertPoint(Invoke->getNormalDest()->getFirstInsertionPt());
----------------
zmodem wrote:
In that case the Builder's insert point is already in the right place.
That's what the "Follow ..." comment refers to. In both cases, we want to follow the await_suspend. It's only for an invoke that we need to jump to the next block.
https://github.com/llvm/llvm-project/pull/89751
More information about the cfe-commits
mailing list