[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 Aug 11 06:56:30 PDT 2025
Roger Ferrer =?utf-8?q?Ibáñez?= <rofirrim at gmail.com>,Roger Ferrer
Ibanez <roger.ferrer at bsc.es>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/139293 at github.com>
================
@@ -1479,7 +1492,85 @@ 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);
+
+ /// Categories of loops encountered during semantic OpenMP loop
+ /// analysis.
+ ///
+ /// This enumeration identifies the structural category of a loop or sequence
+ /// of loops analyzed in the context of OpenMP transformations and directives.
+ /// This categorization helps differentiate between original source loops
+ /// and the structures resulting from applying OpenMP loop transformations.
+ enum class OMPLoopCategory {
+ /// @var OMPLoopCategory::RegularLoop
+ /// Represents a standard canonical loop nest found in the
+ /// original source code or an intact loop after transformations
+ /// (i.e Post/Pre loops of a loopranged fusion).
+ RegularLoop,
+
+ /// @var OMPLoopCategory::TransformSingleLoop
+ /// Represents the resulting loop structure when an OpenMP loop
+ /// transformation, generates a single, top-level loop.
+ TransformSingleLoop,
+ };
+
+ /// Holds the result of the analysis of a (possibly canonical) loop.
+ struct LoopAnalysis {
+ /// Category of the analyzed loop.
+ OMPLoopCategory Category;
+ /// Loop analyses results.
+ OMPLoopBasedDirective::HelperExprs HelperExprs;
+ /// The for-statement of the loop.
+ Stmt *ForStmt;
+ /// Initialization statements before transformations.
+ SmallVector<Stmt *> OriginalInits;
+ /// Initialization statements required after transformation of this loop.
+ SmallVector<Stmt *> TransformsPreInits;
+
+ explicit LoopAnalysis(OMPLoopCategory Category) : Category(Category) {}
+ };
+
+ /// Holds the result of the analysis of a (possibly canonical) loop sequence.
+ struct LoopSequenceAnalysis {
+ /// Number of top level canonical loops.
+ unsigned LoopSeqSize = 0;
+ /// Number of canonical loops, including nested.
+ unsigned NumLoops = 0;
+ /// For each loop results of the analysis.
+ std::vector<LoopAnalysis> Loops;
----------------
alexey-bataev wrote:
SmallVector
https://github.com/llvm/llvm-project/pull/139293
More information about the Openmp-commits
mailing list