[clang] [Clang][OpenMP] Add an additional class to hold data that will be shared between all loop transformations (PR #155849)

Michael Kruse via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 29 07:43:30 PDT 2025


================
@@ -956,30 +956,42 @@ class OMPLoopBasedDirective : public OMPExecutableDirective {
   }
 };
 
+/// Common class of data shared between
+/// OMPCanonicalLoopNestTransformationDirective and transformations over
+/// canonical loop sequences.
+class OMPLoopTransformationDirective {
+  /// 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;
----------------
Meinersbur wrote:

Consider reflecting that it is the top-level loops only in the name, such as `NumGeneratedTopLevelLoops`. The OpenMP spec calls then "loop nests" to mean including all the nested loops.

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


More information about the cfe-commits mailing list