[llvm] [Coroutines] fix coroutines + std::unique_ptr with async exceptions validation errors (PR #149691)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 02:42:58 PDT 2025


================
@@ -376,7 +376,16 @@ static void replaceUnwindCoroEnd(AnyCoroEndInst *End, const coro::Shape &Shape,
   // If coro.end has an associated bundle, add cleanupret instruction.
   if (auto Bundle = End->getOperandBundle(LLVMContext::OB_funclet)) {
     auto *FromPad = cast<CleanupPadInst>(Bundle->Inputs[0]);
-    auto *CleanupRet = Builder.CreateCleanupRet(FromPad, nullptr);
+
+    // If the terminator is an invoke,
+    // set the cleanupret unwind destination the same as the other edges, to
+    // avoid validation errors
----------------
tzuralon wrote:

I rewritten comments

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


More information about the llvm-commits mailing list