[clang] [flang] [llvm] [openmp] [Clang][OpenMP][LoopTransformations] Add support for "#pragma omp fuse" loop transformation directive and "looprange" clause (PR #139293)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 20 07:35:14 PDT 2025


================
@@ -1485,7 +1498,81 @@ class SemaOpenMP : public SemaBase {
   bool checkTransformableLoopNest(
       OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
       SmallVectorImpl<OMPLoopBasedDirective::HelperExprs> &LoopHelpers,
-      Stmt *&Body, SmallVectorImpl<SmallVector<Stmt *, 0>> &OriginalInits);
+      Stmt *&Body, SmallVectorImpl<SmallVector<Stmt *>> &OriginalInits);
+
+  /// Holds the result of the analysis of a (possibly canonical) loop.
+  struct LoopAnalysis {
+    /// The analyzed loop or loop transformation.
+    Stmt *AStmt;
+    /// Loop analyses results.
+    OMPLoopBasedDirective::HelperExprs HelperExprs;
+    /// The for-statement of the loop. ForStmt equals AStmt only when the latter
+    /// is a canonical loop (i.e. not a loop transformation).
+    Stmt *ForStmt;
----------------
alexey-bataev wrote:

```suggestion
    Stmt *ForStmt = nullptr;
```

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


More information about the llvm-commits mailing list