[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


================
@@ -3879,11 +3975,13 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
         omp::PrivateClauseOp privatizer = findPrivatizer(&opInst, privSym);
         assert(privatizer.getDataSharingType() !=
                    omp::DataSharingClauseType::FirstPrivate &&
-               privatizer.getDeallocRegion().empty() &&
                "unsupported privatizer");
-        moduleTranslation.mapValue(privatizer.getAllocMoldArg(),
-                                   moduleTranslation.lookupValue(privVar));
         Region &allocRegion = privatizer.getAllocRegion();
+        BlockArgument allocRegionArg = allocRegion.getArgument(0);
+        moduleTranslation.mapValue(
+            allocRegionArg,
+            findHostAssociatedValue(privVar, targetOp, mappedPrivateVars,
+                                    builder, moduleTranslation));
----------------
skatrak wrote:

Nit: I think using the named accessor helps keep things self-documented as much as possible. At least personally, I'd prefer to keep the logic of what argument of what region represents a certain element to the operation itself, rather than exposing this to users.
```suggestion
        moduleTranslation.mapValue(
            privatizer.getAllocMoldArg(),
            findHostAssociatedValue(privVar, targetOp, mappedPrivateVars,
                                    builder, moduleTranslation));
```

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


More information about the Mlir-commits mailing list