[flang-commits] [flang] [llvm] [mlir] [flang][OpenMP] Extend delayed privatization for `omp.simd` (PR #122156)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Fri Jan 10 07:36:49 PST 2025


================
@@ -5207,12 +5207,7 @@ void OpenMPIRBuilder::createIfVersion(CanonicalLoopInfo *CanonicalLoop,
   Function *F = CanonicalLoop->getFunction();
 
   // Define where if branch should be inserted
-  Instruction *SplitBefore;
-  if (Instruction::classof(IfCond)) {
-    SplitBefore = dyn_cast<Instruction>(IfCond);
-  } else {
-    SplitBefore = CanonicalLoop->getPreheader()->getTerminator();
-  }
+  Instruction *SplitBefore = CanonicalLoop->getPreheader()->getTerminator();
----------------
ergawy wrote:

The `IfCond` could happen to be defined by the allocation block where we inline the `omp.private` `alloc` regions. If we split right after `IfCond`, the private allocations will not dominate the `else` version of the loop.

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


More information about the flang-commits mailing list