[flang-commits] [flang] [mlir] [OpenACC] add acc::FirstprivateSaveOp (PR #211011)

Scott Manley via flang-commits flang-commits at lists.llvm.org
Wed Jul 22 05:40:07 PDT 2026


================
@@ -302,6 +302,28 @@ def OpenACC_FirstprivateMapInitialOp
   let extraClassDeclaration = extraClassDeclarationBase;
 }
 
+//===----------------------------------------------------------------------===//
+// acc.firstprivate_save
+//===----------------------------------------------------------------------===//
+
+def OpenACC_FirstprivateSaveOp : OpenACC_Op<"firstprivate_save", []> {
+ let summary = "\"Saves\" a value to a firstprivate variable";
+ let description = [{
+    The `acc.firstprivate_save` operation is intended to provide a temporary
+    link from the compute region's private variable and the firstprivate map
+    init op. This facilitates analysis in cases where the compiler may
+    determine that a firstprivate should be converted to a copy and can be
+    safely erased when that analysis is complete.
+  }];
+  let arguments = (ins AnyType:$value,
----------------
rscottmanley wrote:

Yes, the issue isnt losing the firstprivate - we need to connect the alloca that gets materialized to the firstprivate. The alloca is what gets optimized away - so the value that is tracked through that (or perhaps promoted) needs be to saved somehow.

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


More information about the flang-commits mailing list