[clang] [llvm] [openmp] [Clang][OpenMP] Add `#pragma omp flatten` loop directive + `depth` clause (PR #206977)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 02:08:24 PDT 2026


================
@@ -1490,6 +1490,69 @@ class OMPPartialClause final : public OMPClause {
   }
 };
 
+/// This represents the 'depth' clause on the '#pragma omp flatten' (and
+/// '#pragma omp fuse') loop-transformation directives.
+///
+/// \code
+/// #pragma omp flatten depth(3)
+/// \endcode
+/// In this example the 'flatten' directive has a 'depth' clause whose argument
+/// '3' specifies how many perfectly nested loops are combined into one.
+/// The argument must be a positive integer constant expression that evaluates
+/// to at most the loop nest depth of the associated loop nest.
+class OMPDepthClause final : public OMPClause {
+  friend class OMPClauseReader;
+
+  /// Location of '('.
+  SourceLocation LParenLoc;
+
+  /// The depth expression (number of loops to flatten).
----------------
Meinersbur wrote:

This describes the purpose of the depth expression, not its implementation.

If depth on fuse is implemented, I doubt anyone remembers to update this comment.

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


More information about the llvm-commits mailing list