[clang] [llvm] Loop finalization (PR #214717)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 12:52:47 PDT 2026


================
@@ -16954,6 +16998,18 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
               FusedBody, InitStmt.get()->getBeginLoc(), SourceLocation(),
               IncrExpr.get()->getEndLoc());
 
+  // 8. Build finalization statements for fused loops.
+  // Collect HelperExprs from the fused loops.
+  SmallVector<OMPLoopBasedDirective::HelperExprs, 4> FusedLoopHelpers;
+  SmallVector<Stmt *, 4> FusedLoopStmts;
+  for (unsigned I = FirstVal - 1; I < LastVal; ++I) {
+    if (SeqAnalysis.Loops[I].isRegularLoop() &&
+        isa<ForStmt>(SeqAnalysis.Loops[I].TheForStmt)) {
+      FusedLoopHelpers.push_back(SeqAnalysis.Loops[I].HelperExprs);
+      FusedLoopStmts.push_back(SeqAnalysis.Loops[I].TheForStmt);
+    }
+  }
----------------
alexey-bataev wrote:

Does it update the real variables or the generated ones?

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


More information about the cfe-commits mailing list