[Mlir-commits] [flang] [mlir] [MLIR][OpenMP] Support basic materialization for `omp.private` ops (PR #81715)
Sergio Afonso
llvmlistbot at llvm.org
Thu Feb 15 09:10:38 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());
+
+ const auto *privInitIt = privatizers->begin();
+ for (auto privVarIt = privVars.begin(); privVarIt != privVars.end();
----------------
skatrak wrote:
Nit: Can this loop be rewritten to use `llvm::zip_equal`?
https://github.com/llvm/llvm-project/pull/81715
More information about the Mlir-commits
mailing list