Skip to content

Commit d5edcb9

Browse files
committed
[clang] Prune 'IsOMPStructuredBlock' Stmt bit
As discussed in https://reviews.llvm.org/D59214#1916596 and in some other reviews dealing with FPenv, bits in Stmt are scarce, and i got so burnout with D59214 and https://bugs.llvm.org/show_bug.cgi?id=40563 specifically that i never actually followed up with the usages for this bit. So let's unhoard it, at least for now?
1 parent 4689eae commit d5edcb9

File tree

55 files changed

+425
-1040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+425
-1040
lines changed

clang/docs/LibASTMatchersReference.html

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4181,19 +4181,6 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
41814181
</pre></td></tr>
41824182

41834183

4184-
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>&gt;</td><td class="name" onclick="toggle('isOMPStructuredBlock0')"><a name="isOMPStructuredBlock0Anchor">isOMPStructuredBlock</a></td><td></td></tr>
4185-
<tr><td colspan="4" class="doc" id="isOMPStructuredBlock0"><pre>Matches the Stmt AST node that is marked as being the structured-block
4186-
of an OpenMP executable directive.
4187-
4188-
Given
4189-
4190-
#pragma omp parallel
4191-
{}
4192-
4193-
``stmt(isOMPStructuredBlock()))`` matches ``{}``.
4194-
</pre></td></tr>
4195-
4196-
41974184
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1StringLiteral.html">StringLiteral</a>&gt;</td><td class="name" onclick="toggle('hasSize1')"><a name="hasSize1Anchor">hasSize</a></td><td>unsigned N</td></tr>
41984185
<tr><td colspan="4" class="doc" id="hasSize1"><pre>Matches nodes that have the specified size.
41994186

clang/include/clang/AST/Stmt.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,8 @@ class alignas(void *) Stmt {
9999

100100
/// The statement class.
101101
unsigned sClass : 8;
102-
103-
/// This bit is set only for the Stmts that are the structured-block of
104-
/// OpenMP executable directives. Directives that have a structured block
105-
/// are called "non-standalone" directives.
106-
/// I.e. those returned by OMPExecutableDirective::getStructuredBlock().
107-
unsigned IsOMPStructuredBlock : 1;
108102
};
109-
enum { NumStmtBits = 9 };
103+
enum { NumStmtBits = 8 };
110104

111105
class NullStmtBitfields {
112106
friend class ASTStmtReader;
@@ -1118,7 +1112,6 @@ class alignas(void *) Stmt {
11181112
static_assert(sizeof(*this) % alignof(void *) == 0,
11191113
"Insufficient alignment!");
11201114
StmtBits.sClass = SC;
1121-
StmtBits.IsOMPStructuredBlock = false;
11221115
if (StatisticsEnabled) Stmt::addStmtClass(SC);
11231116
}
11241117

@@ -1128,11 +1121,6 @@ class alignas(void *) Stmt {
11281121

11291122
const char *getStmtClassName() const;
11301123

1131-
bool isOMPStructuredBlock() const { return StmtBits.IsOMPStructuredBlock; }
1132-
void setIsOMPStructuredBlock(bool IsOMPStructuredBlock) {
1133-
StmtBits.IsOMPStructuredBlock = IsOMPStructuredBlock;
1134-
}
1135-
11361124
/// SourceLocation tokens are not useful in isolation - they are low level
11371125
/// value objects created/interpreted by SourceManager. We assume AST
11381126
/// clients will have a pointer to the respective SourceManager.

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7016,19 +7016,6 @@ AST_MATCHER(OMPExecutableDirective, isStandaloneDirective) {
70167016
return Node.isStandaloneDirective();
70177017
}
70187018

7019-
/// Matches the Stmt AST node that is marked as being the structured-block
7020-
/// of an OpenMP executable directive.
7021-
///
7022-
/// Given
7023-
///
7024-
/// \code
7025-
/// #pragma omp parallel
7026-
/// {}
7027-
/// \endcode
7028-
///
7029-
/// ``stmt(isOMPStructuredBlock()))`` matches ``{}``.
7030-
AST_MATCHER(Stmt, isOMPStructuredBlock) { return Node.isOMPStructuredBlock(); }
7031-
70327019
/// Matches the structured-block of the OpenMP executable directive
70337020
///
70347021
/// Prerequisite: the executable directive must not be standalone directive.

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ void TextNodeDumper::Visit(const Stmt *Node) {
123123
dumpPointer(Node);
124124
dumpSourceRange(Node->getSourceRange());
125125

126-
if (Node->isOMPStructuredBlock())
127-
OS << " openmp_structured_block";
128-
129126
if (const auto *E = dyn_cast<Expr>(Node)) {
130127
dumpType(E->getType());
131128

clang/lib/ASTMatchers/Dynamic/Registry.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ RegistryMaps::RegistryMaps() {
398398
REGISTER_MATCHER(isNoReturn);
399399
REGISTER_MATCHER(isNoThrow);
400400
REGISTER_MATCHER(isNoneKind);
401-
REGISTER_MATCHER(isOMPStructuredBlock);
402401
REGISTER_MATCHER(isOverride);
403402
REGISTER_MATCHER(isPrivate);
404403
REGISTER_MATCHER(isProtected);

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5091,12 +5091,6 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
50915091
if (ErrorFound)
50925092
return StmtError();
50935093

5094-
if (!(Res.getAs<OMPExecutableDirective>()->isStandaloneDirective())) {
5095-
Res.getAs<OMPExecutableDirective>()
5096-
->getStructuredBlock()
5097-
->setIsOMPStructuredBlock(true);
5098-
}
5099-
51005094
if (!CurContext->isDependentContext() &&
51015095
isOpenMPTargetExecutionDirective(Kind) &&
51025096
!(DSAStack->hasRequiresDeclWithClause<OMPUnifiedSharedMemoryClause>() ||

clang/lib/Serialization/ASTReaderStmt.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ namespace clang {
102102

103103
/// The number of record fields required for the Stmt class
104104
/// itself.
105-
static const unsigned NumStmtFields = 1;
105+
static const unsigned NumStmtFields = 0;
106106

107107
/// The number of record fields required for the Expr class
108108
/// itself.
@@ -138,7 +138,6 @@ void ASTStmtReader::ReadTemplateKWAndArgsInfo(ASTTemplateKWAndArgsInfo &Args,
138138
}
139139

140140
void ASTStmtReader::VisitStmt(Stmt *S) {
141-
S->setIsOMPStructuredBlock(Record.readInt());
142141
assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count");
143142
}
144143

clang/lib/Serialization/ASTWriterDecl.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,6 @@ void ASTWriter::WriteDeclAbbrevs() {
22742274
Abv = std::make_shared<BitCodeAbbrev>();
22752275
Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
22762276
//Stmt
2277-
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
22782277
// Expr
22792278
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
22802279
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
@@ -2298,7 +2297,6 @@ void ASTWriter::WriteDeclAbbrevs() {
22982297
Abv = std::make_shared<BitCodeAbbrev>();
22992298
Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
23002299
//Stmt
2301-
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
23022300
// Expr
23032301
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
23042302
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
@@ -2317,7 +2315,6 @@ void ASTWriter::WriteDeclAbbrevs() {
23172315
Abv = std::make_shared<BitCodeAbbrev>();
23182316
Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
23192317
//Stmt
2320-
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
23212318
// Expr
23222319
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
23232320
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
@@ -2336,7 +2333,6 @@ void ASTWriter::WriteDeclAbbrevs() {
23362333
Abv = std::make_shared<BitCodeAbbrev>();
23372334
Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
23382335
// Stmt
2339-
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
23402336
// Expr
23412337
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
23422338
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent

clang/lib/Serialization/ASTWriterStmt.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ void ASTStmtWriter::AddTemplateKWAndArgsInfo(
6868
}
6969

7070
void ASTStmtWriter::VisitStmt(Stmt *S) {
71-
Record.push_back(S->StmtBits.IsOMPStructuredBlock);
7271
}
7372

7473
void ASTStmtWriter::VisitNullStmt(NullStmt *S) {

clang/test/AST/ast-dump-openmp-atomic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void test(int i) {
1212
// CHECK-NEXT: `-OMPAtomicDirective {{.*}} <line:4:1, col:19>
1313
// CHECK-NEXT: `-CapturedStmt {{.*}} <line:5:3, col:5>
1414
// CHECK-NEXT: |-CapturedDecl {{.*}} <<invalid sloc>> <invalid sloc>
15-
// CHECK-NEXT: | |-UnaryOperator {{.*}} <col:3, col:5> openmp_structured_block 'int' prefix '++'
15+
// CHECK-NEXT: | |-UnaryOperator {{.*}} <col:3, col:5> 'int' prefix '++'
1616
// CHECK-NEXT: | | `-DeclRefExpr {{.*}} <col:5> 'int' lvalue ParmVar {{.*}} 'i' 'int'
1717
// CHECK-NEXT: | `-ImplicitParamDecl {{.*}} <line:4:1> col:1 implicit __context 'struct (anonymous at {{.*}}ast-dump-openmp-atomic.c:4:1) *const restrict'
1818
// CHECK-NEXT: `-DeclRefExpr {{.*}} <line:5:5> 'int' lvalue ParmVar {{.*}} 'i' 'int'

0 commit comments

Comments
 (0)