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

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 12:06:10 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) {
----------------
NimishMishra wrote:

It is probably the first condition [here](https://github.com/llvm/llvm-project/blob/f740366fa68d3cfceda7efe2d573348253fbb1e9/llvm/lib/Transforms/Utils/CodeExtractor.cpp#L654C1-L654C9) that is ignoring a variable defined outside, but not used within the region.

```c
if (!SinkCands.count(V) && definedInCaller(Blocks, V))
          Inputs.insert(V);
}
```

Would it be unreasonable to let `findInputsOutputs`, and add some `findPrivVars` that checks for `if(definedInCaller(Blocks, V))` and returns the variables?

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


More information about the llvm-commits mailing list