[flang-commits] [flang] [mlir] [MLIR][OpenMP] Support basic materialization for `omp.private` ops (PR #81715)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Thu Feb 15 09:10:41 PST 2024


================
@@ -1092,6 +1113,86 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
                     llvm::Value *&replacementValue) -> InsertPointTy {
     replacementValue = &vPtr;
 
+    // If this is a private value, this lambda will return the corresponding
+    // mlir value and its `PrivateClauseOp`. Otherwise, empty values are
+    // returned.
+    auto [privVar, privatizerClone] =
+        [&]() -> std::pair<mlir::Value, omp::PrivateClauseOp> {
+      if (!opInst.getPrivateVars().empty()) {
+        auto privVars = opInst.getPrivateVars();
+        auto privatizers = opInst.getPrivatizers();
+        assert(privatizers && privatizers->size() == privVars.size());
----------------
skatrak wrote:

Nit: Is this assert needed? It seems to be already checked in the op verifier.

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


More information about the flang-commits mailing list