Skip to content

Commit 38286f3

Browse files
committed
Remove unused attribute from OMPCanonicalLoopSequenceTransformationDirective
When I refactored the hierarchy I had the impression it would be used but it is not. Also remove a stray NumGeneratedLoopNests field in OMPFuseDirective that I forgot to remove during the refactoring.
1 parent 8323cde commit 38286f3

File tree

5 files changed

+20
-43
lines changed

5 files changed

+20
-43
lines changed

clang/include/clang/AST/StmtOpenMP.h

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5966,21 +5966,14 @@ class OMPCanonicalLoopSequenceTransformationDirective
59665966
public OMPLoopTransformationDirective {
59675967
friend class ASTStmtReader;
59685968

5969-
/// Number of loops contained in the canonical loop sequence.
5970-
unsigned NumLoopsInSequence = 1;
5971-
59725969
protected:
59735970
explicit OMPCanonicalLoopSequenceTransformationDirective(
59745971
StmtClass SC, OpenMPDirectiveKind Kind, SourceLocation StartLoc,
5975-
SourceLocation EndLoc, unsigned NumLoopsInSequence)
5972+
SourceLocation EndLoc)
59765973
: OMPExecutableDirective(SC, Kind, StartLoc, EndLoc),
5977-
OMPLoopTransformationDirective(this),
5978-
NumLoopsInSequence(NumLoopsInSequence) {}
5974+
OMPLoopTransformationDirective(this) {}
59795975

59805976
public:
5981-
/// Returns the number of canonical loop nests contained in this sequence.
5982-
unsigned getNumLoopsInSequence() const { return NumLoopsInSequence; }
5983-
59845977
/// Get the de-sugared statements after the loop transformation.
59855978
///
59865979
/// Might be nullptr if either the directive generates no loops and is handled
@@ -6018,13 +6011,9 @@ class OMPFuseDirective final
60186011
TransformedStmtOffset,
60196012
};
60206013

6021-
unsigned NumGeneratedLoopNests = 1;
6022-
6023-
explicit OMPFuseDirective(SourceLocation StartLoc, SourceLocation EndLoc,
6024-
unsigned NumLoopsInSequence)
6014+
explicit OMPFuseDirective(SourceLocation StartLoc, SourceLocation EndLoc)
60256015
: OMPCanonicalLoopSequenceTransformationDirective(
6026-
OMPFuseDirectiveClass, llvm::omp::OMPD_fuse, StartLoc, EndLoc,
6027-
NumLoopsInSequence) {}
6016+
OMPFuseDirectiveClass, llvm::omp::OMPD_fuse, StartLoc, EndLoc) {}
60286017

60296018
void setPreInits(Stmt *PreInits) {
60306019
Data->getChildren()[PreInitsOffset] = PreInits;
@@ -6051,17 +6040,16 @@ class OMPFuseDirective final
60516040
/// \param PreInits Helper preinits statements for the loop nest
60526041
static OMPFuseDirective *
60536042
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
6054-
ArrayRef<OMPClause *> Clauses, unsigned NumLoops,
6055-
unsigned NumGeneratedTopLevelLoops, Stmt *AssociatedStmt,
6056-
Stmt *TransformedStmt, Stmt *PreInits);
6043+
ArrayRef<OMPClause *> Clauses, unsigned NumGeneratedTopLevelLoops,
6044+
Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits);
60576045

60586046
/// Build an empty '#pragma omp fuse' AST node for deserialization
60596047
///
60606048
/// \param C Context of the AST
60616049
/// \param NumClauses Number of clauses to allocate
60626050
/// \param NumLoops Number of top level loops to allocate
6063-
static OMPFuseDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
6064-
unsigned NumLoops);
6051+
static OMPFuseDirective *CreateEmpty(const ASTContext &C,
6052+
unsigned NumClauses);
60656053

60666054
/// Gets the associated loops after the transformation. This is the de-sugared
60676055
/// replacement or nulltpr in dependent contexts.

clang/lib/AST/StmtOpenMP.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -552,28 +552,24 @@ OMPInterchangeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
552552
SourceLocation(), SourceLocation(), NumLoops);
553553
}
554554

555-
OMPFuseDirective *
556-
OMPFuseDirective::Create(const ASTContext &C, SourceLocation StartLoc,
557-
SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses,
558-
unsigned NumLoops, unsigned NumGeneratedTopLevelLoops,
559-
Stmt *AssociatedStmt, Stmt *TransformedStmt,
560-
Stmt *PreInits) {
555+
OMPFuseDirective *OMPFuseDirective::Create(
556+
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
557+
ArrayRef<OMPClause *> Clauses, unsigned NumGeneratedTopLevelLoops,
558+
Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits) {
561559

562560
OMPFuseDirective *Dir = createDirective<OMPFuseDirective>(
563-
C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc,
564-
NumLoops);
561+
C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc);
565562
Dir->setTransformedStmt(TransformedStmt);
566563
Dir->setPreInits(PreInits);
567564
Dir->setNumGeneratedTopLevelLoops(NumGeneratedTopLevelLoops);
568565
return Dir;
569566
}
570567

571568
OMPFuseDirective *OMPFuseDirective::CreateEmpty(const ASTContext &C,
572-
unsigned NumClauses,
573-
unsigned NumLoops) {
569+
unsigned NumClauses) {
574570
OMPFuseDirective *Dir = createEmptyDirective<OMPFuseDirective>(
575571
C, NumClauses, /*HasAssociatedStmt=*/true, TransformedStmtOffset + 1,
576-
SourceLocation(), SourceLocation(), NumLoops);
572+
SourceLocation(), SourceLocation());
577573
return Dir;
578574
}
579575

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16005,11 +16005,9 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
1600516005
// The NumLoopNests argument is set to a placeholder 1 (even though
1600616006
// using looprange fuse could yield up to 3 top level loop nests)
1600716007
// because a dependent context could prevent determining its true value
16008-
if (CurrContext->isDependentContext()) {
16008+
if (CurrContext->isDependentContext())
1600916009
return OMPFuseDirective::Create(Context, StartLoc, EndLoc, Clauses,
16010-
/* NumLoops */ 1, /* LoopSeqSize */ 1,
16011-
AStmt, nullptr, nullptr);
16012-
}
16010+
/* NumLoops */ 1, AStmt, nullptr, nullptr);
1601316011

1601416012
// Validate that the potential loop sequence is transformable for fusion
1601516013
// Also collect the HelperExprs, Loop Stmts, Inits, and Number of loops
@@ -16464,7 +16462,6 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
1646416462
SourceLocation(), SourceLocation());
1646516463
}
1646616464
return OMPFuseDirective::Create(Context, StartLoc, EndLoc, Clauses,
16467-
SeqAnalysis.LoopSeqSize,
1646816465
NumGeneratedTopLevelLoops, AStmt, FusionStmt,
1646916466
buildPreInits(Context, PreInits));
1647016467
}

clang/lib/Serialization/ASTReaderStmt.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,8 +2472,6 @@ void ASTStmtReader::VisitOMPReverseDirective(OMPReverseDirective *D) {
24722472
void ASTStmtReader::VisitOMPCanonicalLoopSequenceTransformationDirective(
24732473
OMPCanonicalLoopSequenceTransformationDirective *D) {
24742474
VisitStmt(D);
2475-
// Field NumLoopsInSequence was read in ReadStmtFromStream.
2476-
Record.skipInts(1);
24772475
VisitOMPExecutableDirective(D);
24782476
D->setNumGeneratedTopLevelLoops(Record.readUInt32());
24792477
}
@@ -3627,11 +3625,10 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
36273625
S = OMPReverseDirective::CreateEmpty(Context, NumLoops);
36283626
break;
36293627
}
3628+
36303629
case STMT_OMP_FUSE_DIRECTIVE: {
3631-
unsigned NumLoopsInSequence = Record[ASTStmtReader::NumStmtFields];
3632-
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
3633-
S = OMPFuseDirective::CreateEmpty(Context, NumClauses,
3634-
NumLoopsInSequence);
3630+
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
3631+
S = OMPFuseDirective::CreateEmpty(Context, NumClauses);
36353632
break;
36363633
}
36373634

clang/lib/Serialization/ASTWriterStmt.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,6 @@ void ASTStmtWriter::VisitOMPInterchangeDirective(OMPInterchangeDirective *D) {
24902490
void ASTStmtWriter::VisitOMPCanonicalLoopSequenceTransformationDirective(
24912491
OMPCanonicalLoopSequenceTransformationDirective *D) {
24922492
VisitStmt(D);
2493-
Record.writeUInt32(D->getNumLoopsInSequence());
24942493
VisitOMPExecutableDirective(D);
24952494
Record.writeUInt32(D->getNumGeneratedTopLevelLoops());
24962495
}

0 commit comments

Comments
 (0)