[clang] [llvm] [coro] Lower `llvm.coro.await.suspend.handle` to resume with tail call (PR #89751)

Chuanqi Xu via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 07:56:55 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());
----------------
ChuanqiXu9 wrote:

What if the CB is a call inst? It may be possible if the exception are disabled.

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


More information about the llvm-commits mailing list