[Mlir-commits] [flang] [llvm] [mlir] [MLIR][OpenMP] Handle privatization for global values in MLIR->LLVM translation (PR #104407)

Kareem Ergawy llvmlistbot at llvm.org
Wed Aug 21 21:11:19 PDT 2024


================
@@ -1548,7 +1548,16 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel(
   BasicBlock *CommonExit = nullptr;
   SetVector<Value *> Inputs, Outputs, SinkingCands, HoistingCands;
   Extractor.findAllocas(CEAC, SinkingCands, HoistingCands, CommonExit);
-  Extractor.findInputsOutputs(Inputs, Outputs, SinkingCands);
+
+  Extractor.findInputsOutputs(Inputs, Outputs, SinkingCands,
+                              /*CollectGlobalInputs=*/true);
+
+  Inputs.remove_if([&](Value *I) {
----------------
ergawy wrote:

The problem with that is:
- `OpenMPIRBuilder::Ident` are created and maintained by the functions of the `OpenMPIRBuilder`. So I think it would be preferable to keep the knowledge of these structs within the builder.
- The `CodeExtractor` is not OpenMP-related and I think it would better not to leak any non-related OpenMP-details to it.

Of course it is better not to add something and then remove it. But I think it logically isolates things better this way.

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


More information about the Mlir-commits mailing list