@@ -14513,7 +14513,7 @@ bool SemaOpenMP::analyzeLoopSequence(Stmt *LoopSeqStmt,
14513
14513
// Vast majority: (Tile, Unroll, Stripe, Reverse, Interchange, Fuse all)
14514
14514
// Process the transformed loop statement
14515
14515
LoopAnalysis &NewTransformedSingleLoop =
14516
- SeqAnalysis.Loops.emplace_back(OMPLoopCategory::TransformSingleLoop );
14516
+ SeqAnalysis.Loops.emplace_back(Child );
14517
14517
unsigned IsCanonical = checkOpenMPLoop(
14518
14518
Kind, nullptr, nullptr, TransformedStmt, SemaRef, *DSAStack, TmpDSA,
14519
14519
NewTransformedSingleLoop.HelperExprs);
@@ -14531,7 +14531,7 @@ bool SemaOpenMP::analyzeLoopSequence(Stmt *LoopSeqStmt,
14531
14531
// Modularized code for handling regular canonical loops.
14532
14532
auto AnalyzeRegularLoop = [&](Stmt *Child) {
14533
14533
LoopAnalysis &NewRegularLoop =
14534
- SeqAnalysis.Loops.emplace_back(OMPLoopCategory::RegularLoop );
14534
+ SeqAnalysis.Loops.emplace_back(Child );
14535
14535
unsigned IsCanonical =
14536
14536
checkOpenMPLoop(Kind, nullptr, nullptr, Child, SemaRef, *DSAStack,
14537
14537
TmpDSA, NewRegularLoop.HelperExprs);
@@ -14545,21 +14545,12 @@ bool SemaOpenMP::analyzeLoopSequence(Stmt *LoopSeqStmt,
14545
14545
return true;
14546
14546
};
14547
14547
14548
- // Helper functions to validate loop sequence grammar derivations.
14549
- auto IsLoopSequenceDerivation = [](auto *Child) {
14550
- return isa<ForStmt, CXXForRangeStmt, OMPLoopTransformationDirective>(Child);
14551
- };
14552
- // Helper functions to validate loop generating grammar derivations.
14553
- auto IsLoopGeneratingStmt = [](auto *Child) {
14554
- return isa<OMPLoopTransformationDirective>(Child);
14555
- };
14556
-
14557
14548
// High level grammar validation.
14558
14549
for (Stmt *Child : LoopSeqStmt->children()) {
14559
14550
if (!Child)
14560
14551
continue;
14561
14552
// Skip over non-loop-sequence statements.
14562
- if (!IsLoopSequenceDerivation (Child)) {
14553
+ if (!LoopSequenceAnalysis::isLoopSequenceDerivation (Child)) {
14563
14554
Child = Child->IgnoreContainers();
14564
14555
// Ignore empty compound statement.
14565
14556
if (!Child)
@@ -14574,8 +14565,8 @@ bool SemaOpenMP::analyzeLoopSequence(Stmt *LoopSeqStmt,
14574
14565
}
14575
14566
}
14576
14567
// Regular loop sequence handling.
14577
- if (IsLoopSequenceDerivation (Child)) {
14578
- if (IsLoopGeneratingStmt (Child)) {
14568
+ if (LoopSequenceAnalysis::isLoopSequenceDerivation (Child)) {
14569
+ if (LoopAnalysis::isLoopTransformation (Child)) {
14579
14570
if (!AnalyzeLoopGeneration(Child))
14580
14571
return false;
14581
14572
// AnalyzeLoopGeneration updates SeqAnalysis.LoopSeqSize accordingly.
@@ -16073,17 +16064,16 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
16073
16064
// looprange section
16074
16065
unsigned int TransformIndex = 0;
16075
16066
for (unsigned I : llvm::seq<unsigned>(FirstVal - 1)) {
16076
- if (SeqAnalysis.Loops[I].Category == OMPLoopCategory::TransformSingleLoop )
16067
+ if (SeqAnalysis.Loops[I].isLoopTransformation() )
16077
16068
++TransformIndex;
16078
16069
}
16079
16070
16080
16071
for (unsigned int I = FirstVal - 1, J = 0; I < LastVal; ++I, ++J) {
16081
- if (SeqAnalysis.Loops[I].Category == OMPLoopCategory::RegularLoop ) {
16072
+ if (SeqAnalysis.Loops[I].isRegularLoop() ) {
16082
16073
addLoopPreInits(Context, SeqAnalysis.Loops[I].HelperExprs,
16083
16074
SeqAnalysis.Loops[I].ForStmt,
16084
16075
SeqAnalysis.Loops[I].OriginalInits, PreInits);
16085
- } else if (SeqAnalysis.Loops[I].Category ==
16086
- OMPLoopCategory::TransformSingleLoop) {
16076
+ } else if (SeqAnalysis.Loops[I].isLoopTransformation()) {
16087
16077
// For transformed loops, insert both pre-inits and original inits.
16088
16078
// Order matters: pre-inits may define variables used in the original
16089
16079
// inits such as upper bounds...
@@ -16352,8 +16342,7 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
16352
16342
if (I >= FirstVal - 1 && I < FirstVal + CountVal - 1) {
16353
16343
// Update the Transformation counter to skip already treated
16354
16344
// loop transformations
16355
- if (SeqAnalysis.Loops[I].Category !=
16356
- OMPLoopCategory::TransformSingleLoop)
16345
+ if (!SeqAnalysis.Loops[I].isLoopTransformation())
16357
16346
++TransformIndex;
16358
16347
continue;
16359
16348
}
@@ -16362,8 +16351,7 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
16362
16351
// Regular loops: they are kept intact as-is.
16363
16352
// Loop-sequence-generating transformations: already handled earlier.
16364
16353
// Only TransformSingleLoop requires inserting pre-inits here
16365
- if (SeqAnalysis.Loops[I].Category ==
16366
- OMPLoopCategory::TransformSingleLoop) {
16354
+ if (SeqAnalysis.Loops[I].isRegularLoop()) {
16367
16355
const auto &TransformPreInit =
16368
16356
SeqAnalysis.Loops[TransformIndex++].TransformsPreInits;
16369
16357
if (!TransformPreInit.empty())
0 commit comments