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

Mats Petersson via flang-commits flang-commits at lists.llvm.org
Tue Aug 20 10:32:23 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) {
----------------
Leporacanthicus wrote:

Would it not be better to NOT add the global value in the first place, if it's an `OpenMPIRBuilder::Ident`? You already do `isa` in the code below, so doing a `GV = dyn_cast_if_present` instead and follow that with a `getValueType != OpenMPIRBuilder::Ident`?

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


More information about the flang-commits mailing list