================
@@ -423,6 +423,16 @@ CIRGenFunction::emitCoroutineBody(const CoroutineBodyStmt 
&s) {
     auto initialSuspendBuilder = [&]() -> mlir::LogicalResult {
       if (emitStmt(s.getPromiseDeclStmt(), /*useCurrentScope=*/true).failed())
         return mlir::failure();
+      // Update coro.id to refer to the promise. We could not do it earlier
+      // because the promise local variable was not emitted yet.
+      Address promiseAddr = getAddrOfLocalVar(s.getPromiseDecl());
+      {
+        mlir::OpBuilder::InsertionGuard guard(builder);
+        builder.setInsertionPoint(coroId);
+        mlir::Value promisePtr = builder.createBitcast(
----------------
erichkeane wrote:

Hmm... a 'more specific' pointer kind than void might be a nice addition to 
this feature in the future, but relaxing it to 'any pointer' is probably 
reasonable to stop this from having to happen.

https://github.com/llvm/llvm-project/pull/236293
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to