Skip to content

Commit 5218ea3

Browse files
authored
merge main into amd-staging (llvm#1440)
2 parents e9b040d + f573db0 commit 5218ea3

File tree

246 files changed

+6902
-2683
lines changed

Some content is hidden

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

246 files changed

+6902
-2683
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,13 @@ Hexagon Support
429429
X86 Support
430430
^^^^^^^^^^^
431431

432-
- Disable ``-m[no-]avx10.1`` and switch ``-m[no-]avx10.2`` to alias of 512 bit
433-
options.
434-
- Change ``-mno-avx10.1-512`` to alias of ``-mno-avx10.1-256`` to disable both
435-
256 and 512 bit instructions.
432+
- The 256-bit maximum vector register size control was removed from
433+
`AVX10 whitepaper <https://cdrdv2.intel.com/v1/dl/getContent/784343>_`.
434+
* Re-target ``m[no-]avx10.1`` to enable AVX10.1 with 512-bit maximum vector register size.
435+
* Emit warning for ``mavx10.x-256``, noting AVX10/256 is not supported.
436+
* Emit warning for ``mavx10.x-512``, noting to use ``m[no-]avx10.x`` instead.
437+
* Emit warning for ``m[no-]evex512``, noting AVX10/256 is not supported.
438+
* The features avx10.x-256/512 keep unchanged and will be removed in the next release.
436439

437440
Arm and AArch64 Support
438441
^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,12 @@ def CXX11WarnSuggestOverride : DiagGroup<"suggest-override">;
377377
def WarnUnnecessaryVirtualSpecifier : DiagGroup<"unnecessary-virtual-specifier"> {
378378
code Documentation = [{
379379
Warns when a ``final`` class contains a virtual method (including virtual
380-
destructors). Since ``final`` classes cannot be subclassed, their methods
381-
cannot be overridden, and hence the ``virtual`` specifier is useless.
380+
destructors) that does not override anything. Since ``final`` classes cannot be
381+
subclassed, their methods cannot be overridden, so there is no point to
382+
introducing new ``virtual`` methods.
382383

383384
The warning also detects virtual methods in classes whose destructor is
384385
``final``, for the same reason.
385-
386-
The warning does not fire on virtual methods which are also marked ``override``.
387386
}];
388387
}
389388

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,7 +2733,7 @@ def note_final_dtor_non_final_class_silence : Note<
27332733
"mark %0 as '%select{final|sealed}1' to silence this warning">;
27342734
def warn_unnecessary_virtual_specifier : Warning<
27352735
"virtual method %0 is inside a 'final' class and can never be overridden">,
2736-
InGroup<WarnUnnecessaryVirtualSpecifier>, DefaultIgnore;
2736+
InGroup<WarnUnnecessaryVirtualSpecifier>;
27372737

27382738
// C++11 attributes
27392739
def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
@@ -7031,10 +7031,10 @@ def err_offsetof_incomplete_type : Error<
70317031
def err_offsetof_record_type : Error<
70327032
"offsetof requires struct, union, or class type, %0 invalid">;
70337033
def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
7034-
def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
7034+
def ext_offsetof_non_pod_type : ExtWarn<"'offsetof' on non-POD type %0">,
70357035
InGroup<InvalidOffsetof>;
70367036
def ext_offsetof_non_standardlayout_type : ExtWarn<
7037-
"offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
7037+
"'offsetof' on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
70387038
def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
70397039
def err_offsetof_field_of_virtual_base : Error<
70407040
"invalid application of 'offsetof' to a field of a virtual base">;

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6552,11 +6552,11 @@ def mavx10_1_256 : Flag<["-"], "mavx10.1-256">, Group<m_x86_AVX10_Features_Group
65526552
def mno_avx10_1_256 : Flag<["-"], "mno-avx10.1-256">, Group<m_x86_AVX10_Features_Group>;
65536553
def mavx10_1_512 : Flag<["-"], "mavx10.1-512">, Group<m_x86_AVX10_Features_Group>;
65546554
def mno_avx10_1_512 : Flag<["-"], "mno-avx10.1-512">, Alias<mno_avx10_1_256>;
6555-
def mavx10_1 : Flag<["-"], "mavx10.1">, Flags<[Unsupported]>;
6556-
def mno_avx10_1 : Flag<["-"], "mno-avx10.1">, Flags<[Unsupported]>;
6555+
def mavx10_1 : Flag<["-"], "mavx10.1">, Group<m_x86_AVX10_Features_Group>;
6556+
def mno_avx10_1 : Flag<["-"], "mno-avx10.1">, Group<m_x86_AVX10_Features_Group>;
65576557
def mavx10_2_256 : Flag<["-"], "mavx10.2-256">, Group<m_x86_AVX10_Features_Group>;
65586558
def mavx10_2_512 : Flag<["-"], "mavx10.2-512">, Group<m_x86_AVX10_Features_Group>;
6559-
def mavx10_2 : Flag<["-"], "mavx10.2">, Alias<mavx10_2_512>;
6559+
def mavx10_2 : Flag<["-"], "mavx10.2">, Group<m_x86_AVX10_Features_Group>;
65606560
def mno_avx10_2 : Flag<["-"], "mno-avx10.2">, Group<m_x86_AVX10_Features_Group>;
65616561
def mavx2 : Flag<["-"], "mavx2">, Group<m_x86_Features_Group>;
65626562
def mno_avx2 : Flag<["-"], "mno-avx2">, Group<m_x86_Features_Group>;

clang/lib/CodeGen/CGCall.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,15 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
26082608
if (shouldDisableTailCalls())
26092609
FuncAttrs.addAttribute("disable-tail-calls", "true");
26102610

2611+
// These functions require the returns_twice attribute for correct codegen,
2612+
// but the attribute may not be added if -fno-builtin is specified. We
2613+
// explicitly add that attribute here.
2614+
static const llvm::StringSet<> ReturnsTwiceFn{
2615+
"_setjmpex", "setjmp", "_setjmp", "vfork",
2616+
"sigsetjmp", "__sigsetjmp", "savectx", "getcontext"};
2617+
if (ReturnsTwiceFn.contains(Name))
2618+
FuncAttrs.addAttribute(llvm::Attribute::ReturnsTwice);
2619+
26112620
// CPU/feature overrides. addDefaultFunctionDefinitionAttributes
26122621
// handles these separately to set them based on the global defaults.
26132622
GetCPUAndFeaturesAttributes(CalleeInfo.getCalleeDecl(), FuncAttrs);

clang/lib/CodeGen/CGHLSLBuiltins.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ static Value *handleHlslClip(const CallExpr *E, CodeGenFunction *CGF) {
6666
CMP = CGF->Builder.CreateIntrinsic(
6767
CGF->Builder.getInt1Ty(), CGF->CGM.getHLSLRuntime().getAnyIntrinsic(),
6868
{FCompInst});
69-
} else
69+
} else {
7070
CMP = CGF->Builder.CreateFCmpOLT(Op0, FZeroConst);
71+
}
7172

72-
if (CGF->CGM.getTarget().getTriple().isDXIL())
73-
LastInstr =
74-
CGF->Builder.CreateIntrinsic(CGF->VoidTy, Intrinsic::dx_discard, {CMP});
75-
else if (CGF->CGM.getTarget().getTriple().isSPIRV()) {
73+
if (CGF->CGM.getTarget().getTriple().isDXIL()) {
74+
LastInstr = CGF->Builder.CreateIntrinsic(Intrinsic::dx_discard, {CMP});
75+
} else if (CGF->CGM.getTarget().getTriple().isSPIRV()) {
7676
BasicBlock *LT0 = CGF->createBasicBlock("lt0", CGF->CurFn);
7777
BasicBlock *End = CGF->createBasicBlock("end", CGF->CurFn);
7878

7979
CGF->Builder.CreateCondBr(CMP, LT0, End);
8080

8181
CGF->Builder.SetInsertPoint(LT0);
8282

83-
CGF->Builder.CreateIntrinsic(CGF->VoidTy, Intrinsic::spv_discard, {});
83+
CGF->Builder.CreateIntrinsic(Intrinsic::spv_discard, {});
8484

8585
LastInstr = CGF->Builder.CreateBr(End);
8686
CGF->Builder.SetInsertPoint(End);
@@ -109,7 +109,6 @@ static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) {
109109
Value *HighBits = nullptr;
110110

111111
if (CGF->CGM.getTarget().getTriple().isDXIL()) {
112-
113112
llvm::Type *RetElementTy = CGF->Int32Ty;
114113
if (auto *Op0VecTy = E->getArg(0)->getType()->getAs<clang::VectorType>())
115114
RetElementTy = llvm::VectorType::get(
@@ -121,7 +120,6 @@ static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) {
121120

122121
LowBits = CGF->Builder.CreateExtractValue(CI, 0);
123122
HighBits = CGF->Builder.CreateExtractValue(CI, 1);
124-
125123
} else {
126124
// For Non DXIL targets we generate the instructions.
127125

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD,
385385
SmallVector<OperandBundleDef, 1> OB;
386386
if (CGM.shouldEmitConvergenceTokens()) {
387387
assert(EntryFn->isConvergent());
388-
llvm::Value *I = B.CreateIntrinsic(
389-
llvm::Intrinsic::experimental_convergence_entry, {}, {});
388+
llvm::Value *I =
389+
B.CreateIntrinsic(llvm::Intrinsic::experimental_convergence_entry, {});
390390
llvm::Value *bundleArgs[] = {I};
391391
OB.emplace_back("convergencectrl", bundleArgs);
392392
}

clang/lib/Driver/ToolChains/Arch/X86.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,18 @@ void x86::getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple,
243243
assert((Version == "1" || Version == "2") && "Invalid AVX10 feature name.");
244244

245245
if (Width == "") {
246-
assert(IsNegative && "Only negative options can omit width.");
247-
Features.push_back(Args.MakeArgString("-" + Name + "-256"));
246+
if (IsNegative)
247+
Features.push_back(Args.MakeArgString("-" + Name + "-256"));
248+
else
249+
Features.push_back(Args.MakeArgString("+" + Name + "-512"));
248250
} else {
249-
assert((Width == "256" || Width == "512") && "Invalid vector length.");
251+
if (Width == "512")
252+
D.Diag(diag::warn_drv_deprecated_arg) << Name << 1 << Name.drop_back(4);
253+
else if (Width == "256")
254+
D.Diag(diag::warn_drv_deprecated_custom)
255+
<< Name << "because AVX10/256 is not supported and will be removed";
256+
else
257+
assert((Width == "256" || Width == "512") && "Invalid vector length.");
250258
Features.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name));
251259
}
252260
}
@@ -275,6 +283,11 @@ void x86::getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple,
275283
D.Diag(diag::err_drv_unsupported_opt_for_target)
276284
<< A->getSpelling() << Triple.getTriple();
277285

286+
if (A->getOption().matches(options::OPT_mevex512) ||
287+
A->getOption().matches(options::OPT_mno_evex512))
288+
D.Diag(diag::warn_drv_deprecated_custom)
289+
<< Name << "because AVX10/256 is not supported and will be removed";
290+
278291
if (A->getOption().matches(options::OPT_mapx_features_EQ) ||
279292
A->getOption().matches(options::OPT_mno_apx_features_EQ)) {
280293

clang/lib/Format/FormatToken.h

Lines changed: 51 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ struct AdditionalKeywords {
12431243
kw_unique0 = &IdentTable.get("unique0");
12441244
kw_uwire = &IdentTable.get("uwire");
12451245
kw_vectored = &IdentTable.get("vectored");
1246+
kw_wait = &IdentTable.get("wait");
12461247
kw_wand = &IdentTable.get("wand");
12471248
kw_weak0 = &IdentTable.get("weak0");
12481249
kw_weak1 = &IdentTable.get("weak1");
@@ -1299,70 +1300,49 @@ struct AdditionalKeywords {
12991300
// treatment like `showcancelled` or they should be treated as identifiers
13001301
// like `int` and `logic`.
13011302
VerilogExtraKeywords = std::unordered_set<IdentifierInfo *>(
1302-
{kw_always, kw_always_comb,
1303-
kw_always_ff, kw_always_latch,
1304-
kw_assert, kw_assign,
1305-
kw_assume, kw_automatic,
1306-
kw_before, kw_begin,
1307-
kw_bins, kw_binsof,
1308-
kw_casex, kw_casez,
1309-
kw_celldefine, kw_checker,
1310-
kw_clocking, kw_constraint,
1311-
kw_cover, kw_covergroup,
1312-
kw_coverpoint, kw_disable,
1313-
kw_dist, kw_edge,
1314-
kw_end, kw_endcase,
1315-
kw_endchecker, kw_endclass,
1316-
kw_endclocking, kw_endfunction,
1317-
kw_endgenerate, kw_endgroup,
1318-
kw_endinterface, kw_endmodule,
1319-
kw_endpackage, kw_endprimitive,
1320-
kw_endprogram, kw_endproperty,
1321-
kw_endsequence, kw_endspecify,
1322-
kw_endtable, kw_endtask,
1323-
kw_extends, kw_final,
1324-
kw_foreach, kw_forever,
1325-
kw_fork, kw_function,
1326-
kw_generate, kw_highz0,
1327-
kw_highz1, kw_iff,
1328-
kw_ifnone, kw_ignore_bins,
1329-
kw_illegal_bins, kw_implements,
1330-
kw_import, kw_initial,
1331-
kw_inout, kw_input,
1332-
kw_inside, kw_interconnect,
1333-
kw_interface, kw_intersect,
1334-
kw_join, kw_join_any,
1335-
kw_join_none, kw_large,
1336-
kw_let, kw_local,
1337-
kw_localparam, kw_macromodule,
1338-
kw_matches, kw_medium,
1339-
kw_negedge, kw_output,
1340-
kw_package, kw_packed,
1341-
kw_parameter, kw_posedge,
1342-
kw_primitive, kw_priority,
1343-
kw_program, kw_property,
1344-
kw_pull0, kw_pull1,
1345-
kw_pure, kw_rand,
1346-
kw_randc, kw_randcase,
1347-
kw_randsequence, kw_ref,
1348-
kw_repeat, kw_sample,
1349-
kw_scalared, kw_sequence,
1350-
kw_small, kw_soft,
1351-
kw_solve, kw_specify,
1352-
kw_specparam, kw_strong0,
1353-
kw_strong1, kw_supply0,
1354-
kw_supply1, kw_table,
1355-
kw_tagged, kw_task,
1356-
kw_tri, kw_tri0,
1357-
kw_tri1, kw_triand,
1358-
kw_trior, kw_trireg,
1359-
kw_unique, kw_unique0,
1360-
kw_uwire, kw_var,
1361-
kw_vectored, kw_wand,
1362-
kw_weak0, kw_weak1,
1363-
kw_wildcard, kw_wire,
1364-
kw_with, kw_wor,
1365-
kw_verilogHash, kw_verilogHashHash});
1303+
{kw_always, kw_always_comb, kw_always_ff,
1304+
kw_always_latch, kw_assert, kw_assign,
1305+
kw_assume, kw_automatic, kw_before,
1306+
kw_begin, kw_bins, kw_binsof,
1307+
kw_casex, kw_casez, kw_celldefine,
1308+
kw_checker, kw_clocking, kw_constraint,
1309+
kw_cover, kw_covergroup, kw_coverpoint,
1310+
kw_disable, kw_dist, kw_edge,
1311+
kw_end, kw_endcase, kw_endchecker,
1312+
kw_endclass, kw_endclocking, kw_endfunction,
1313+
kw_endgenerate, kw_endgroup, kw_endinterface,
1314+
kw_endmodule, kw_endpackage, kw_endprimitive,
1315+
kw_endprogram, kw_endproperty, kw_endsequence,
1316+
kw_endspecify, kw_endtable, kw_endtask,
1317+
kw_extends, kw_final, kw_foreach,
1318+
kw_forever, kw_fork, kw_function,
1319+
kw_generate, kw_highz0, kw_highz1,
1320+
kw_iff, kw_ifnone, kw_ignore_bins,
1321+
kw_illegal_bins, kw_implements, kw_import,
1322+
kw_initial, kw_inout, kw_input,
1323+
kw_inside, kw_interconnect, kw_interface,
1324+
kw_intersect, kw_join, kw_join_any,
1325+
kw_join_none, kw_large, kw_let,
1326+
kw_local, kw_localparam, kw_macromodule,
1327+
kw_matches, kw_medium, kw_negedge,
1328+
kw_output, kw_package, kw_packed,
1329+
kw_parameter, kw_posedge, kw_primitive,
1330+
kw_priority, kw_program, kw_property,
1331+
kw_pull0, kw_pull1, kw_pure,
1332+
kw_rand, kw_randc, kw_randcase,
1333+
kw_randsequence, kw_ref, kw_repeat,
1334+
kw_sample, kw_scalared, kw_sequence,
1335+
kw_small, kw_soft, kw_solve,
1336+
kw_specify, kw_specparam, kw_strong0,
1337+
kw_strong1, kw_supply0, kw_supply1,
1338+
kw_table, kw_tagged, kw_task,
1339+
kw_tri, kw_tri0, kw_tri1,
1340+
kw_triand, kw_trior, kw_trireg,
1341+
kw_unique, kw_unique0, kw_uwire,
1342+
kw_var, kw_vectored, kw_wait,
1343+
kw_wand, kw_weak0, kw_weak1,
1344+
kw_wildcard, kw_wire, kw_with,
1345+
kw_wor, kw_verilogHash, kw_verilogHashHash});
13661346

13671347
TableGenExtraKeywords = std::unordered_set<IdentifierInfo *>({
13681348
kw_assert,
@@ -1614,6 +1594,7 @@ struct AdditionalKeywords {
16141594
IdentifierInfo *kw_unique0;
16151595
IdentifierInfo *kw_uwire;
16161596
IdentifierInfo *kw_vectored;
1597+
IdentifierInfo *kw_wait;
16171598
IdentifierInfo *kw_wand;
16181599
IdentifierInfo *kw_weak0;
16191600
IdentifierInfo *kw_weak1;
@@ -1849,8 +1830,12 @@ struct AdditionalKeywords {
18491830
/// Returns whether \p Tok is a Verilog keyword that opens a block.
18501831
bool isVerilogBegin(const FormatToken &Tok) const {
18511832
// `table` is not included since it needs to be treated specially.
1852-
return !Tok.endsSequence(kw_fork, kw_disable) &&
1853-
Tok.isOneOf(kw_begin, kw_fork, kw_generate, kw_specify);
1833+
if (Tok.isOneOf(kw_begin, kw_generate, kw_specify))
1834+
return true;
1835+
if (Tok.isNot(kw_fork))
1836+
return false;
1837+
const auto *Prev = Tok.getPreviousNonComment();
1838+
return !(Prev && Prev->isOneOf(kw_disable, kw_wait));
18541839
}
18551840

18561841
/// Returns whether \p Tok is a Verilog keyword that closes a block.

clang/lib/Format/FormatTokenLexer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,15 +1306,12 @@ FormatToken *FormatTokenLexer::getNextToken() {
13061306
FormatTok->isOneOf(tok::kw_struct, tok::kw_union, tok::kw_delete,
13071307
tok::kw_operator)) {
13081308
FormatTok->Tok.setKind(tok::identifier);
1309-
FormatTok->Tok.setIdentifierInfo(nullptr);
13101309
} else if (Style.isJavaScript() &&
13111310
FormatTok->isOneOf(tok::kw_struct, tok::kw_union,
13121311
tok::kw_operator)) {
13131312
FormatTok->Tok.setKind(tok::identifier);
1314-
FormatTok->Tok.setIdentifierInfo(nullptr);
13151313
} else if (Style.isTableGen() && !Keywords.isTableGenKeyword(*FormatTok)) {
13161314
FormatTok->Tok.setKind(tok::identifier);
1317-
FormatTok->Tok.setIdentifierInfo(nullptr);
13181315
}
13191316
} else if (FormatTok->is(tok::greatergreater)) {
13201317
FormatTok->Tok.setKind(tok::greater);

0 commit comments

Comments
 (0)