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

Alexey Bataev via Openmp-commits openmp-commits at lists.llvm.org
Mon Sep 1 07:59:35 PDT 2025


================
@@ -955,31 +960,69 @@ class OMPLoopBasedDirective : public OMPExecutableDirective {
   }
 };
 
-/// The base class for all loop transformation directives.
-class OMPLoopTransformationDirective : public OMPLoopBasedDirective {
+/// Common class of data shared between
+/// OMPCanonicalLoopNestTransformationDirective and
+/// OMPCanonicalLoopSequenceTransformationDirective
+class OMPLoopTransformationDirective {
   friend class ASTStmtReader;
 
-  /// Number of loops generated by this loop transformation.
-  unsigned NumGeneratedLoops = 0;
+  /// Number of (top-level) generated loops.
+  /// This value is 1 for most transformations as they only map one loop nest
+  /// into another.
+  /// Some loop transformations (like a non-partial 'unroll') may not generate
+  /// a loop nest, so this would be 0.
+  /// Some loop transformations (like 'fuse' with looprange and 'split') may
+  /// generate more than one loop nest, so the value would be >= 1.
+  unsigned NumGeneratedLoops = 1;
+
+  /// We need this because we cannot easily make OMPLoopTransformationDirective
+  /// a proper Stmt.
+  Stmt *S;
----------------
alexey-bataev wrote:

```suggestion
  Stmt *S = nullptr;
```

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


More information about the Openmp-commits mailing list