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

Weibo He via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 17 06:43:53 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
----------------
NewSigma wrote:

The "validation errors" is confusing to maintainers that not familiar to this bug. Maybe we could drop it.

BTW, there are some similar comments that are context-dependent. It would be great if you could reword them.

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


More information about the llvm-commits mailing list