[clang] [clang][CodeGen] Promote point of GRO(CWG2563) (PR #151067)

Weibo He via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 14 18:22:01 PST 2025


================
@@ -768,6 +779,41 @@ struct GetReturnObjectManager {
     CGF.EmitAutoVarInit(GroEmission);
     Builder.CreateStore(Builder.getTrue(), GroActiveFlag);
   }
+
+  void EmitGroConv() {
+    // GRO conversion is unnecessary when get_return_object's type matches the
+    // coroutine return type.
+    if (DirectEmit)
+      return;
+
+    auto *InsertPt = Builder.GetInsertBlock();
----------------
NewSigma wrote:

Thanks for the code review. After checking, `InsertPt` serves as the resume destination of the `final.exit` block (see comments of `EmitGroConv` for the defination of `final.exit`), and `final.exit` itself may not be directly accessible. In this revision, I add an assumption that we will fallthrough from the `final.exit` block. Not sure if there is a more direct approach.

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


More information about the cfe-commits mailing list