[flang-commits] [flang] [mlir] [acc] Support for Optionals in firstprivate recipes. (PR #185764)

via flang-commits flang-commits at lists.llvm.org
Wed Mar 11 01:56:42 PDT 2026


================
@@ -893,42 +917,68 @@ mlir::Value OpenACCMappableModel<Ty>::generatePrivateInit(
       retVal = box;
     }
   }
+  }
+
+  if (isOptional) {
+    fir::ResultOp::create(builder, loc, retVal);
+    builder.setInsertionPointToStart(&optIfOp->getElseRegion().front());
+    mlir::Value zero = fir::ZeroOp::create(builder, loc, type);
----------------
jeanPerier wrote:

fir::AbsentOp is more idiomatic (although with the chosen implementation of OPTIONAL it is equivalent in the end). 

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


More information about the flang-commits mailing list