Skip to content

Commit 57fe14d

Browse files
committed
Merged main:0fa59c636278 into amd-gfx:d71fa76be0d3
Local branch amd-gfx d71fa76 Revert "[AMDGPU] Emit S_CBRANCH_SCC for floating-point conditions. (llvm#120588)" Remote branch main 0fa59c6 [llvm][Docs] Update supported hardware (llvm#121743) Change-Id: Ic39049333a827f4a1840c385d1d6ce004af4bd64
2 parents d71fa76 + 0fa59c6 commit 57fe14d

File tree

580 files changed

+31584
-14612
lines changed

Some content is hidden

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

580 files changed

+31584
-14612
lines changed

.github/new-prs-labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,11 @@ backend:DirectX:
661661

662662
backend:SPIR-V:
663663
- clang/lib/Driver/ToolChains/SPIRV.*
664+
- clang/lib/Sema/SemaSPIRV.cpp
665+
- clang/include/clang/Sema/SemaSPIRV.h
666+
- clang/include/clang/Basic/BuiltinsSPIRV.td
667+
- clang/test/CodeGenSPIRV/**
668+
- clang/test/SemaSPIRV/**
664669
- llvm/lib/Target/SPIRV/**
665670
- llvm/test/CodeGen/SPIRV/**
666671
- llvm/test/Frontend/HLSL/**

bolt/lib/Core/BinaryEmitter.cpp

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,13 @@ BreakFunctionNames("break-funcs",
4646
cl::Hidden,
4747
cl::cat(BoltCategory));
4848

49-
cl::list<std::string>
50-
FunctionPadSpec("pad-funcs", cl::CommaSeparated,
51-
cl::desc("list of functions to pad with amount of bytes"),
52-
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."),
53-
cl::Hidden, cl::cat(BoltCategory));
54-
55-
cl::list<std::string> FunctionPadBeforeSpec(
56-
"pad-funcs-before", cl::CommaSeparated,
57-
cl::desc("list of functions to pad with amount of bytes"),
58-
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."), cl::Hidden,
59-
cl::cat(BoltCategory));
49+
static cl::list<std::string>
50+
FunctionPadSpec("pad-funcs",
51+
cl::CommaSeparated,
52+
cl::desc("list of functions to pad with amount of bytes"),
53+
cl::value_desc("func1:pad1,func2:pad2,func3:pad3,..."),
54+
cl::Hidden,
55+
cl::cat(BoltCategory));
6056

6157
static cl::opt<bool> MarkFuncs(
6258
"mark-funcs",
@@ -74,12 +70,11 @@ X86AlignBranchBoundaryHotOnly("x86-align-branch-boundary-hot-only",
7470
cl::init(true),
7571
cl::cat(BoltOptCategory));
7672

77-
size_t padFunction(const cl::list<std::string> &Spec,
78-
const BinaryFunction &Function) {
73+
size_t padFunction(const BinaryFunction &Function) {
7974
static std::map<std::string, size_t> FunctionPadding;
8075

81-
if (FunctionPadding.empty() && !Spec.empty()) {
82-
for (const std::string &Spec : Spec) {
76+
if (FunctionPadding.empty() && !FunctionPadSpec.empty()) {
77+
for (std::string &Spec : FunctionPadSpec) {
8378
size_t N = Spec.find(':');
8479
if (N == std::string::npos)
8580
continue;
@@ -324,32 +319,6 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
324319
Streamer.emitCodeAlignment(Function.getAlign(), &*BC.STI);
325320
}
326321

327-
if (size_t Padding =
328-
opts::padFunction(opts::FunctionPadBeforeSpec, Function)) {
329-
// Handle padFuncsBefore after the above alignment logic but before
330-
// symbol addresses are decided.
331-
if (!BC.HasRelocations) {
332-
BC.errs() << "BOLT-ERROR: -pad-before-funcs is not supported in "
333-
<< "non-relocation mode\n";
334-
exit(1);
335-
}
336-
337-
// Preserve Function.getMinAlign().
338-
if (!isAligned(Function.getMinAlign(), Padding)) {
339-
BC.errs() << "BOLT-ERROR: user-requested " << Padding
340-
<< " padding bytes before function " << Function
341-
<< " is not a multiple of the minimum function alignment ("
342-
<< Function.getMinAlign().value() << ").\n";
343-
exit(1);
344-
}
345-
346-
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: padding before function " << Function
347-
<< " with " << Padding << " bytes\n");
348-
349-
// Since the padding is not executed, it can be null bytes.
350-
Streamer.emitFill(Padding, 0);
351-
}
352-
353322
MCContext &Context = Streamer.getContext();
354323
const MCAsmInfo *MAI = Context.getAsmInfo();
355324

@@ -404,7 +373,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
404373
emitFunctionBody(Function, FF, /*EmitCodeOnly=*/false);
405374

406375
// Emit padding if requested.
407-
if (size_t Padding = opts::padFunction(opts::FunctionPadSpec, Function)) {
376+
if (size_t Padding = opts::padFunction(Function)) {
408377
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: padding function " << Function << " with "
409378
<< Padding << " bytes\n");
410379
Streamer.emitFill(Padding, MAI->getTextAlignFillValue());

bolt/lib/Passes/ReorderFunctions.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ extern cl::OptionCategory BoltOptCategory;
2828
extern cl::opt<unsigned> Verbosity;
2929
extern cl::opt<uint32_t> RandomSeed;
3030

31-
extern size_t padFunction(const cl::list<std::string> &Spec,
32-
const bolt::BinaryFunction &Function);
33-
extern cl::list<std::string> FunctionPadSpec, FunctionPadBeforeSpec;
31+
extern size_t padFunction(const bolt::BinaryFunction &Function);
3432

3533
extern cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions;
3634
cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions(
@@ -306,12 +304,8 @@ Error ReorderFunctions::runOnFunctions(BinaryContext &BC) {
306304
return false;
307305
if (B->isIgnored())
308306
return true;
309-
const size_t PadA =
310-
opts::padFunction(opts::FunctionPadSpec, *A) +
311-
opts::padFunction(opts::FunctionPadBeforeSpec, *A);
312-
const size_t PadB =
313-
opts::padFunction(opts::FunctionPadSpec, *B) +
314-
opts::padFunction(opts::FunctionPadBeforeSpec, *B);
307+
const size_t PadA = opts::padFunction(*A);
308+
const size_t PadB = opts::padFunction(*B);
315309
if (!PadA || !PadB) {
316310
if (PadA)
317311
return true;

bolt/test/AArch64/pad-before-funcs.s

Lines changed: 0 additions & 29 deletions
This file was deleted.

clang/bindings/python/clang/cindex.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,12 +2125,26 @@ def get_field_offsetof(self):
21252125

21262126
def is_anonymous(self):
21272127
"""
2128-
Check if the record is anonymous.
2128+
Check whether this is a record type without a name, or a field where
2129+
the type is a record type without a name.
2130+
2131+
Use is_anonymous_record_decl to check whether a record is an
2132+
"anonymous union" as defined in the C/C++ standard.
21292133
"""
21302134
if self.kind == CursorKind.FIELD_DECL:
21312135
return self.type.get_declaration().is_anonymous()
21322136
return conf.lib.clang_Cursor_isAnonymous(self) # type: ignore [no-any-return]
21332137

2138+
def is_anonymous_record_decl(self):
2139+
"""
2140+
Check if the record is an anonymous union as defined in the C/C++ standard
2141+
(or an "anonymous struct", the corresponding non-standard extension for
2142+
structs).
2143+
"""
2144+
if self.kind == CursorKind.FIELD_DECL:
2145+
return self.type.get_declaration().is_anonymous_record_decl()
2146+
return conf.lib.clang_Cursor_isAnonymousRecordDecl(self) # type: ignore [no-any-return]
2147+
21342148
def is_bitfield(self):
21352149
"""
21362150
Check if the field is a bitfield.
@@ -3902,12 +3916,13 @@ def write_main_file_to_stdout(self):
39023916
("clang_Cursor_getTemplateArgumentType", [Cursor, c_uint], Type),
39033917
("clang_Cursor_getTemplateArgumentValue", [Cursor, c_uint], c_longlong),
39043918
("clang_Cursor_getTemplateArgumentUnsignedValue", [Cursor, c_uint], c_ulonglong),
3905-
("clang_Cursor_isAnonymous", [Cursor], bool),
3906-
("clang_Cursor_isBitField", [Cursor], bool),
39073919
("clang_Cursor_getBinaryOpcode", [Cursor], c_int),
39083920
("clang_Cursor_getBriefCommentText", [Cursor], _CXString),
39093921
("clang_Cursor_getRawCommentText", [Cursor], _CXString),
39103922
("clang_Cursor_getOffsetOfField", [Cursor], c_longlong),
3923+
("clang_Cursor_isAnonymous", [Cursor], bool),
3924+
("clang_Cursor_isAnonymousRecordDecl", [Cursor], bool),
3925+
("clang_Cursor_isBitField", [Cursor], bool),
39113926
("clang_Location_isInSystemHeader", [SourceLocation], bool),
39123927
("clang_Type_getAlignOf", [Type], c_longlong),
39133928
("clang_Type_getClassType", [Type], Type),

clang/bindings/python/tests/cindex/test_type.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,11 @@ def test_offset(self):
463463
self.assertNotEqual(children[0].spelling, "typeanon")
464464
self.assertEqual(children[1].spelling, "typeanon")
465465
self.assertEqual(fields[0].kind, CursorKind.FIELD_DECL)
466+
self.assertTrue(fields[0].is_anonymous())
467+
self.assertFalse(fields[0].is_anonymous_record_decl())
466468
self.assertEqual(fields[1].kind, CursorKind.FIELD_DECL)
467469
self.assertTrue(fields[1].is_anonymous())
470+
self.assertTrue(fields[1].is_anonymous_record_decl())
468471
self.assertEqual(teststruct.type.get_offset("typeanon"), f1)
469472
self.assertEqual(teststruct.type.get_offset("bariton"), bariton)
470473
self.assertEqual(teststruct.type.get_offset("foo"), foo)

clang/docs/LibASTMatchersReference.html

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

34513451

3452+
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DependentScopeDeclRefExpr.html">DependentScopeDeclRefExpr</a>&gt;</td><td class="name" onclick="toggle('hasDependentName0')"><a name="hasDependentName0Anchor">hasDependentName</a></td><td>std::string N</td></tr>
3453+
<tr><td colspan="4" class="doc" id="hasDependentName0"><pre>Matches the dependent name of a DependentScopeDeclRefExpr.
3454+
3455+
Matches the dependent name of a DependentScopeDeclRefExpr
3456+
3457+
Given:
3458+
3459+
template &lt;class T&lt; class X : T { void f() { T::v; } };
3460+
3461+
dependentScopeDeclRefExpr(hasDependentName("v")) matches `T::v`
3462+
</pre></td></tr>
3463+
3464+
34523465
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('memberHasSameNameAsBoundNode0')"><a name="memberHasSameNameAsBoundNode0Anchor">memberHasSameNameAsBoundNode</a></td><td>std::string BindingID</td></tr>
34533466
<tr><td colspan="4" class="doc" id="memberHasSameNameAsBoundNode0"><pre>Matches template-dependent, but known, member names against an already-bound
34543467
node

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,9 @@ Bug Fixes to C++ Support
886886
out of a module (which is the case e.g. in MSVC's implementation of ``std`` module). (#GH118218)
887887
- Fixed a pack expansion issue in checking unexpanded parameter sizes. (#GH17042)
888888
- Fixed a bug where captured structured bindings were modifiable inside non-mutable lambda (#GH95081)
889+
- Passing incomplete types to ``__is_base_of`` and other builtin type traits for which the corresponding
890+
standard type trait mandates a complete type is now a hard (non-sfinae-friendly) error
891+
(`LWG3929 <https://wg21.link/LWG3929>`__.) (#GH121278)
889892
- Clang now identifies unexpanded parameter packs within the type constraint on a non-type template parameter. (#GH88866)
890893
- Fixed an issue while resolving type of expression indexing into a pack of values of non-dependent type (#GH121242)
891894

@@ -1116,6 +1119,8 @@ AST Matchers
11161119

11171120
- Add ``dependentTemplateSpecializationType`` matcher to match a dependent template specialization type.
11181121

1122+
- Add ``hasDependentName`` matcher to match the dependent name of a DependentScopeDeclRefExpr.
1123+
11191124
clang-format
11201125
------------
11211126

@@ -1270,6 +1275,8 @@ Sanitizers
12701275
Python Binding Changes
12711276
----------------------
12721277
- Fixed an issue that led to crashes when calling ``Type.get_exception_specification_kind``.
1278+
- Added binding for ``clang_Cursor_isAnonymousRecordDecl``, which allows checking if
1279+
a declaration is an anonymous union or anonymous struct.
12731280

12741281
OpenMP Support
12751282
--------------

clang/include/clang-c/Index.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2198,7 +2198,11 @@ enum CXCursorKind {
21982198
*/
21992199
CXCursor_OpenACCShutdownConstruct = 329,
22002200

2201-
CXCursor_LastStmt = CXCursor_OpenACCShutdownConstruct,
2201+
/** OpenACC set Construct.
2202+
*/
2203+
CXCursor_OpenACCSetConstruct = 330,
2204+
2205+
CXCursor_LastStmt = CXCursor_OpenACCSetConstruct,
22022206

22032207
/**
22042208
* Cursor that represents the translation unit itself.

clang/include/clang/AST/OpenACCClause.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,19 @@ class OpenACCDeviceNumClause : public OpenACCClauseWithSingleIntExpr {
633633
SourceLocation EndLoc);
634634
};
635635

636+
class OpenACCDefaultAsyncClause : public OpenACCClauseWithSingleIntExpr {
637+
OpenACCDefaultAsyncClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
638+
Expr *IntExpr, SourceLocation EndLoc);
639+
640+
public:
641+
static bool classof(const OpenACCClause *C) {
642+
return C->getClauseKind() == OpenACCClauseKind::DefaultAsync;
643+
}
644+
static OpenACCDefaultAsyncClause *
645+
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
646+
Expr *IntExpr, SourceLocation EndLoc);
647+
};
648+
636649
/// Represents a 'collapse' clause on a 'loop' construct. This clause takes an
637650
/// integer constant expression 'N' that represents how deep to collapse the
638651
/// construct. It also takes an optional 'force' tag that permits intervening

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4080,6 +4080,8 @@ DEF_TRAVERSE_STMT(OpenACCInitConstruct,
40804080
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
40814081
DEF_TRAVERSE_STMT(OpenACCShutdownConstruct,
40824082
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
4083+
DEF_TRAVERSE_STMT(OpenACCSetConstruct,
4084+
{ TRY_TO(VisitOpenACCClauseList(S->clauses())); })
40834085

40844086
// Traverse HLSL: Out argument expression
40854087
DEF_TRAVERSE_STMT(HLSLOutArgExpr, {})

clang/include/clang/AST/StmtOpenACC.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,5 +672,45 @@ class OpenACCShutdownConstruct final
672672
SourceLocation End, ArrayRef<const OpenACCClause *> Clauses);
673673
};
674674

675+
// This class represents a 'set' construct, which has just a clause list.
676+
class OpenACCSetConstruct final
677+
: public OpenACCConstructStmt,
678+
private llvm::TrailingObjects<OpenACCSetConstruct,
679+
const OpenACCClause *> {
680+
friend TrailingObjects;
681+
OpenACCSetConstruct(unsigned NumClauses)
682+
: OpenACCConstructStmt(OpenACCSetConstructClass,
683+
OpenACCDirectiveKind::Set, SourceLocation{},
684+
SourceLocation{}, SourceLocation{}) {
685+
std::uninitialized_value_construct(
686+
getTrailingObjects<const OpenACCClause *>(),
687+
getTrailingObjects<const OpenACCClause *>() + NumClauses);
688+
setClauseList(MutableArrayRef(getTrailingObjects<const OpenACCClause *>(),
689+
NumClauses));
690+
}
691+
692+
OpenACCSetConstruct(SourceLocation Start, SourceLocation DirectiveLoc,
693+
SourceLocation End,
694+
ArrayRef<const OpenACCClause *> Clauses)
695+
: OpenACCConstructStmt(OpenACCSetConstructClass,
696+
OpenACCDirectiveKind::Set, Start, DirectiveLoc,
697+
End) {
698+
std::uninitialized_copy(Clauses.begin(), Clauses.end(),
699+
getTrailingObjects<const OpenACCClause *>());
700+
setClauseList(MutableArrayRef(getTrailingObjects<const OpenACCClause *>(),
701+
Clauses.size()));
702+
}
703+
704+
public:
705+
static bool classof(const Stmt *T) {
706+
return T->getStmtClass() == OpenACCSetConstructClass;
707+
}
708+
static OpenACCSetConstruct *CreateEmpty(const ASTContext &C,
709+
unsigned NumClauses);
710+
static OpenACCSetConstruct *Create(const ASTContext &C, SourceLocation Start,
711+
SourceLocation DirectiveLoc,
712+
SourceLocation End,
713+
ArrayRef<const OpenACCClause *> Clauses);
714+
};
675715
} // namespace clang
676716
#endif // LLVM_CLANG_AST_STMTOPENACC_H

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ class TextNodeDumper
417417
void VisitOpenACCHostDataConstruct(const OpenACCHostDataConstruct *S);
418418
void VisitOpenACCWaitConstruct(const OpenACCWaitConstruct *S);
419419
void VisitOpenACCInitConstruct(const OpenACCInitConstruct *S);
420+
void VisitOpenACCSetConstruct(const OpenACCSetConstruct *S);
420421
void VisitOpenACCShutdownConstruct(const OpenACCShutdownConstruct *S);
421422
void VisitOpenACCAsteriskSizeExpr(const OpenACCAsteriskSizeExpr *S);
422423
void VisitEmbedExpr(const EmbedExpr *S);

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3257,6 +3257,17 @@ AST_MATCHER_P(CXXDependentScopeMemberExpr, memberHasSameNameAsBoundNode,
32573257
});
32583258
}
32593259

3260+
/// Matches the dependent name of a DependentScopeDeclRefExpr
3261+
///
3262+
/// Given:
3263+
/// \code
3264+
/// template <class T> class X : T { void f() { T::v; } };
3265+
/// \endcode
3266+
/// \c dependentScopeDeclRefExpr(hasDependentName("v")) matches `T::v`
3267+
AST_MATCHER_P(DependentScopeDeclRefExpr, hasDependentName, std::string, N) {
3268+
return Node.getDeclName().getAsString() == N;
3269+
}
3270+
32603271
/// Matches C++ classes that are directly or indirectly derived from a class
32613272
/// matching \c Base, or Objective-C classes that directly or indirectly
32623273
/// subclass a class matching \c Base.

clang/include/clang/Basic/Attr.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4335,6 +4335,16 @@ def HLSLLoopHint: StmtAttr {
43354335
let Documentation = [HLSLLoopHintDocs, HLSLUnrollHintDocs];
43364336
}
43374337

4338+
def HLSLControlFlowHint: StmtAttr {
4339+
/// [branch]
4340+
/// [flatten]
4341+
let Spellings = [Microsoft<"branch">, Microsoft<"flatten">];
4342+
let Subjects = SubjectList<[IfStmt],
4343+
ErrorDiag, "'if' statements">;
4344+
let LangOpts = [HLSL];
4345+
let Documentation = [InternalOnly];
4346+
}
4347+
43384348
def CapturedRecord : InheritableAttr {
43394349
// This attribute has no spellings as it is only ever created implicitly.
43404350
let Spellings = [];

0 commit comments

Comments
 (0)