[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
Fri Feb 16 04:26:44 PST 2024


================
@@ -1000,6 +1000,26 @@ convertOmpWsLoop(Operation &opInst, llvm::IRBuilderBase &builder,
   return success();
 }
 
+/// Replace the region arguments of the parallel op (which correspond to private
+/// variables) with the actual private varibles they correspond to. This
+/// prepares the parallel op so that it matches what is expected by the
+/// OMPIRBuilder.
+static void prepareOmpParallelForPrivatization(omp::ParallelOp opInst) {
----------------
skatrak wrote:

Thank you for the explanation, I understand the problem a bit better now. At the moment it might be the case that this is the last time the `omp.parallel` operation is used, but in general we shouldn't make modifications to the MLIR operations during translation to LLVM IR or we would introduce some hard to debug problems in the future.

When processing the `omp.private` ops you're creating clones, making changes to those and then deleting them, could something like this be done for `omp.parallel`? That way we wouldn't have to rely on the `omp.parallel` operation never being used again after translation.

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


More information about the flang-commits mailing list