[Mlir-commits] [flang] [llvm] [mlir] [mlir][OpenMP] - MLIR to LLVMIR translation support for delayed privatization of allocatables in `omp.target` ops (PR #116576)

Sergio Afonso llvmlistbot at llvm.org
Fri Dec 6 05:52:36 PST 2024


================
@@ -135,6 +135,15 @@ def PrivateClauseOp : OpenMP_Op<"private", [IsolatedFromAbove, RecipeInterface]>
       auto &region = getDeallocRegion();
       return region.empty() ? nullptr : region.getArgument(0);
     }
+
+    /// needsMap returns true if the value being privatized should additionally
+    /// be mapped to the target region using a MapInfoOp. This is most common
+    /// when an allocatable is privatized. In such cases, the descriptor is used
+    /// in privatization and needs to be mapped on to the device.
+    bool needsMap() {
+      Value blockArg0 = getAllocRegion().getArgument(0);
+      return !blockArg0.use_empty();
----------------
skatrak wrote:

Nit: This can be slightly simplified.
```suggestion
      return !getAllocMoldArg().use_empty();
```

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


More information about the Mlir-commits mailing list