Skip to content

Commit 2fe5697

Browse files
Merge branch 'llvm:main' into cray-ptr-size
2 parents 1859b21 + 23a341e commit 2fe5697

File tree

1,389 files changed

+57088
-52849
lines changed

Some content is hidden

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

1,389 files changed

+57088
-52849
lines changed

bolt/lib/Core/DIEBuilder.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ void DIEBuilder::updateReferences() {
175175
LocExpr.Die.replaceValue(getState().DIEAlloc, LocExpr.Attr, LocExpr.Form,
176176
Value);
177177
}
178-
179-
return;
180178
}
181179

182180
uint32_t DIEBuilder::allocDIE(const DWARFUnit &DU, const DWARFDie &DDie,

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,6 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
783783
Inst.setOpcode(RISCV::ADD);
784784
Inst.insert(Inst.begin(), MCOperand::createReg(Reg));
785785
Inst.insert(Inst.begin() + 1, MCOperand::createReg(RISCV::X0));
786-
return;
787786
}
788787

789788
InstructionListType createLoadImmediate(const MCPhysReg Dest,

clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ setupTemplate(std::unique_ptr<MustacheTemplateFile> &Template,
8383
if (Error Err = T.takeError())
8484
return Err;
8585
Template = std::move(T.get());
86-
for (const auto [Name, FileName] : Partials)
86+
for (const auto &[Name, FileName] : Partials)
8787
if (auto Err = Template->registerPartialFile(Name, FileName))
8888
return Err;
8989
return Error::success();

clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ std::string LLVMHeaderGuardCheck::getHeaderGuard(StringRef Filename,
4040
// Unlike LLVM svn, LLVM git monorepo is named llvm-project, so we replace
4141
// "/llvm-project/" with the canonical "/llvm/".
4242
const static StringRef LLVMProject = "/llvm-project/";
43-
size_t PosLLVMProject = Guard.rfind(std::string(LLVMProject));
43+
size_t PosLLVMProject = Guard.rfind(LLVMProject);
4444
if (PosLLVMProject != StringRef::npos)
4545
Guard = Guard.replace(PosLLVMProject, LLVMProject.size(), "/llvm/");
4646

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: rm -rf %t && mkdir -p %t
2+
3+
// RUN: clang-doc --output=%t --executor=standalone %s
4+
// RUN: find %t/ -regex ".*/[0-9A-F]*.yaml" -exec cat {} ";" | FileCheck %s --check-prefix=CHECK-YAML
5+
6+
// RUN: clang-doc --format=html --output=%t --executor=standalone %s
7+
// FileCheck %s --check-prefix=CHECK-HTML
8+
9+
template <typename T>
10+
struct MyStruct {
11+
operator T();
12+
};
13+
14+
// Output incorrect conversion names.
15+
// CHECK-YAML: Name: 'operator type-parameter-0-0'
16+
// CHECK-YAML-NOT: Name: 'operator T'
17+
18+
// CHECK-HTML-NOT: <h3 id='{{[0-9A-F]*}}'>operator T</h3>
19+
// CHECK-HTML-NOT: <p>public T operator T()</p>

clang/docs/ReleaseNotes.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,33 @@ Improvements to Clang's diagnostics
565565

566566
- Clang now suggests corrections for unknown attribute names.
567567

568+
- ``-Wswitch`` will now diagnose unhandled enumerators in switches also when
569+
the enumerator is deprecated. Warnings about using deprecated enumerators in
570+
switch cases have moved behind a new ``-Wdeprecated-switch-case`` flag.
571+
572+
For example:
573+
574+
.. code-block:: c
575+
576+
enum E {
577+
Red,
578+
Green,
579+
Blue [[deprecated]]
580+
};
581+
void example(enum E e) {
582+
switch (e) {
583+
case Red: // stuff...
584+
case Green: // stuff...
585+
}
586+
}
587+
588+
will result in a warning about ``Blue`` not being handled in the switch.
589+
590+
The warning can be fixed either by adding a ``default:``, or by adding
591+
``case Blue:``. Since the enumerator is deprecated, the latter approach will
592+
trigger a ``'Blue' is deprecated`` warning, which can be turned off with
593+
``-Wno-deprecated-switch-case``.
594+
568595
Improvements to Clang's time-trace
569596
----------------------------------
570597

@@ -767,6 +794,7 @@ Bug Fixes to C++ Support
767794
- Clang could incorrectly instantiate functions in discarded contexts (#GH140449)
768795
- Fix instantiation of default-initialized variable template specialization. (#GH140632) (#GH140622)
769796
- Clang modules now allow a module and its user to differ on TrivialAutoVarInit*
797+
- Fixed an access checking bug when initializing non-aggregates in default arguments (#GH62444), (#GH83608)
770798

771799
Bug Fixes to AST Handling
772800
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ def DeprecatedCopyWithDtor : DiagGroup<"deprecated-copy-with-dtor", [DeprecatedC
234234
def DeprecatedLiteralOperator : DiagGroup<"deprecated-literal-operator">;
235235
// For compatibility with GCC.
236236
def : DiagGroup<"deprecated-copy-dtor", [DeprecatedCopyWithDtor]>;
237-
def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">;
237+
def DeprecatedSwitchCase : DiagGroup<"deprecated-switch-case">;
238+
def DeprecatedDeclarations : DiagGroup<"deprecated-declarations", [DeprecatedSwitchCase]>;
238239
def DeprecatedRedundantConstexprStaticDef : DiagGroup<"deprecated-redundant-constexpr-static-def">;
239240
def UnavailableDeclarations : DiagGroup<"unavailable-declarations">;
240241
def UnguardedAvailabilityNew : DiagGroup<"unguarded-availability-new">;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6038,6 +6038,8 @@ def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to th
60386038
def err_undeclared_use : Error<"use of undeclared %0">;
60396039
def warn_deprecated : Warning<"%0 is deprecated">,
60406040
InGroup<DeprecatedDeclarations>;
6041+
def warn_deprecated_switch_case : Warning<warn_deprecated.Summary>,
6042+
InGroup<DeprecatedSwitchCase>;
60416043
def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
60426044
def warn_property_method_deprecated :
60436045
Warning<"property access is using %0 method which is deprecated">,

clang/include/clang/Basic/riscv_vector.td

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class IsFloat<string type> {
2626

2727
let SupportOverloading = false,
2828
MaskedPolicyScheme = NonePolicy in {
29-
class RVVVLEMaskBuiltin : RVVOutBuiltin<"m", "mPCUe", "c"> {
29+
class RVVVLEMaskBuiltin : RVVOutOp0Builtin<"m", "mPCUe", "c"> {
3030
let Name = "vlm_v";
3131
let IRName = "vlm";
3232
let HasMasked = false;
@@ -40,9 +40,9 @@ let SupportOverloading = false,
4040
IRName = "vle",
4141
MaskedIRName ="vle_mask" in {
4242
foreach type = types in {
43-
def : RVVOutBuiltin<"v", "vPCe", type>;
43+
def : RVVOutOp0Builtin<"v", "vPCe", type>;
4444
if !not(IsFloat<type>.val) then {
45-
def : RVVOutBuiltin<"Uv", "UvPCUe", type>;
45+
def : RVVOutOp0Builtin<"Uv", "UvPCUe", type>;
4646
}
4747
}
4848
}
@@ -63,11 +63,11 @@ multiclass RVVVLEFFBuiltin<list<string> types> {
6363
if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
6464
Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
6565
Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
66-
IntrinsicTypes = {ResultType, Ops[4]->getType()};
66+
IntrinsicTypes = {ResultType, Ops[4]->getType(), Ops[2]->getType()};
6767
} else {
6868
if (PolicyAttrs & RVV_VTA)
6969
Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
70-
IntrinsicTypes = {ResultType, Ops[3]->getType()};
70+
IntrinsicTypes = {ResultType, Ops[3]->getType(), Ops[1]->getType()};
7171
}
7272
Value *NewVL = Ops[2];
7373
Ops.erase(Ops.begin() + 2);
@@ -102,9 +102,9 @@ multiclass RVVVLSEBuiltin<list<string> types> {
102102
SupportOverloading = false,
103103
UnMaskedPolicyScheme = HasPassthruOperand in {
104104
foreach type = types in {
105-
def : RVVOutBuiltin<"v", "vPCet", type>;
105+
def : RVVOutOp0Builtin<"v", "vPCet", type>;
106106
if !not(IsFloat<type>.val) then {
107-
def : RVVOutBuiltin<"Uv", "UvPCUet", type>;
107+
def : RVVOutOp0Builtin<"Uv", "UvPCUet", type>;
108108
}
109109
}
110110
}
@@ -120,9 +120,9 @@ multiclass RVVIndexedLoad<string op> {
120120
RequiredFeatures = !if(!eq(type, "x"), ["Zvfhmin"],
121121
!if(!eq(type, "y"), ["Zvfbfmin"],
122122
[]<string>)) in {
123-
def: RVVOutOp1Builtin<"v", "vPCe" # eew_type # "Uv", type>;
123+
def: RVVOutOp0Op1Builtin<"v", "vPCe" # eew_type # "Uv", type>;
124124
if !not(IsFloat<type>.val) then {
125-
def: RVVOutOp1Builtin<"Uv", "UvPCUe" # eew_type # "Uv", type>;
125+
def: RVVOutOp0Op1Builtin<"Uv", "UvPCUe" # eew_type # "Uv", type>;
126126
}
127127
}
128128
}
@@ -132,9 +132,9 @@ multiclass RVVIndexedLoad<string op> {
132132
RequiredFeatures = !if(!eq(type, "x"), ["Zvfhmin", "RV64"],
133133
!if(!eq(type, "y"), ["Zvfbfmin", "RV64"],
134134
["RV64"])) in {
135-
def: RVVOutOp1Builtin<"v", "vPCe" # eew64_type # "Uv", type>;
135+
def: RVVOutOp0Op1Builtin<"v", "vPCe" # eew64_type # "Uv", type>;
136136
if !not(IsFloat<type>.val) then {
137-
def: RVVOutOp1Builtin<"Uv", "UvPCUe" # eew64_type # "Uv", type>;
137+
def: RVVOutOp0Op1Builtin<"Uv", "UvPCUe" # eew64_type # "Uv", type>;
138138
}
139139
}
140140
}
@@ -152,9 +152,9 @@ let HasMaskedOffOperand = false,
152152
std::swap(Ops[0], Ops[1]);
153153
}
154154
if (IsMasked)
155-
IntrinsicTypes = {Ops[0]->getType(), Ops[3]->getType()};
155+
IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[3]->getType()};
156156
else
157-
IntrinsicTypes = {Ops[0]->getType(), Ops[2]->getType()};
157+
IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[2]->getType()};
158158
}] in {
159159
class RVVVSEMaskBuiltin : RVVBuiltin<"m", "0PUem", "c"> {
160160
let Name = "vsm_v";
@@ -190,9 +190,9 @@ multiclass RVVVSSEBuiltin<list<string> types> {
190190
std::rotate(Ops.begin(), Ops.begin() + 2, Ops.begin() + 3);
191191
}
192192
if (IsMasked)
193-
IntrinsicTypes = {Ops[0]->getType(), Ops[4]->getType()};
193+
IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[4]->getType()};
194194
else
195-
IntrinsicTypes = {Ops[0]->getType(), Ops[3]->getType()};
195+
IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[3]->getType()};
196196
}] in {
197197
foreach type = types in {
198198
def : RVVBuiltin<"v", "0Petv", type>;
@@ -215,9 +215,9 @@ multiclass RVVIndexedStore<string op> {
215215
std::rotate(Ops.begin(), Ops.begin() + 2, Ops.begin() + 3);
216216
}
217217
if (IsMasked)
218-
IntrinsicTypes = {Ops[0]->getType(), Ops[2]->getType(), Ops[4]->getType()};
218+
IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[2]->getType(), Ops[4]->getType()};
219219
else
220-
IntrinsicTypes = {Ops[0]->getType(), Ops[2]->getType(), Ops[3]->getType()};
220+
IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[2]->getType(), Ops[3]->getType()};
221221
}] in {
222222
foreach type = TypeList in {
223223
foreach eew_list = EEWList[0-2] in {
@@ -762,17 +762,18 @@ multiclass RVVUnitStridedSegLoadTuple<string op> {
762762
[]<string>)),
763763
ManualCodegen = [{
764764
{
765-
if (IsMasked)
766-
IntrinsicTypes = {ResultType, Ops[0]->getType(), Ops.back()->getType()};
767-
else
768-
IntrinsicTypes = {ResultType, Ops.back()->getType()};
769765
SmallVector<llvm::Value*, 6> Operands;
770766

771767
bool NoPassthru =
772768
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) |
773769
(!IsMasked && (PolicyAttrs & RVV_VTA));
774770
unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
775771

772+
if (IsMasked)
773+
IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops[0]->getType(), Ops.back()->getType()};
774+
else
775+
IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops.back()->getType()};
776+
776777
if (NoPassthru) { // Push poison into passthru
777778
Operands.push_back(llvm::PoisonValue::get(ResultType));
778779
} else { // Push intrinsics operands into passthru
@@ -845,9 +846,9 @@ multiclass RVVUnitStridedSegStoreTuple<string op> {
845846
Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
846847

847848
if (IsMasked)
848-
IntrinsicTypes = {Operands[0]->getType(), Ops[0]->getType(), Operands.back()->getType()};
849+
IntrinsicTypes = {Operands[0]->getType(), Ops[Offset]->getType(), Ops[0]->getType(), Operands.back()->getType()};
849850
else
850-
IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
851+
IntrinsicTypes = {Operands[0]->getType(), Ops[Offset]->getType(), Operands.back()->getType()};
851852
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
852853
return Builder.CreateCall(F, Operands, "");
853854
}
@@ -882,17 +883,18 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
882883
[]<string>)),
883884
ManualCodegen = [{
884885
{
885-
if (IsMasked)
886-
IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[0]->getType()};
887-
else
888-
IntrinsicTypes = {ResultType, Ops.back()->getType()};
889886
SmallVector<llvm::Value*, 6> Operands;
890887

891888
bool NoPassthru =
892889
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) |
893890
(!IsMasked && (PolicyAttrs & RVV_VTA));
894891
unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
895892

893+
if (IsMasked)
894+
IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[Offset]->getType(), Ops[0]->getType()};
895+
else
896+
IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[Offset]->getType()};
897+
896898
if (NoPassthru) { // Push poison into passthru
897899
Operands.push_back(llvm::PoisonValue::get(ResultType));
898900
} else { // Push intrinsics operands into passthru
@@ -957,17 +959,18 @@ multiclass RVVStridedSegLoadTuple<string op> {
957959
[]<string>)),
958960
ManualCodegen = [{
959961
{
960-
if (IsMasked)
961-
IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[0]->getType()};
962-
else
963-
IntrinsicTypes = {ResultType, Ops.back()->getType()};
964962
SmallVector<llvm::Value*, 7> Operands;
965963

966964
bool NoPassthru =
967965
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) |
968966
(!IsMasked && (PolicyAttrs & RVV_VTA));
969967
unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
970968

969+
if (IsMasked)
970+
IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops.back()->getType(), Ops[0]->getType()};
971+
else
972+
IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops.back()->getType()};
973+
971974
if (NoPassthru) { // Push poison into passthru
972975
Operands.push_back(llvm::PoisonValue::get(ResultType));
973976
} else { // Push intrinsics operands into passthru
@@ -1043,9 +1046,9 @@ multiclass RVVStridedSegStoreTuple<string op> {
10431046
Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
10441047

10451048
if (IsMasked)
1046-
IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType(), Ops[0]->getType()};
1049+
IntrinsicTypes = {Operands[0]->getType(), Operands[1]->getType(), Operands.back()->getType(), Ops[0]->getType()};
10471050
else
1048-
IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
1051+
IntrinsicTypes = {Operands[0]->getType(), Operands[1]->getType(), Operands.back()->getType()};
10491052
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
10501053
return Builder.CreateCall(F, Operands, "");
10511054
}
@@ -1099,11 +1102,13 @@ multiclass RVVIndexedSegLoadTuple<string op> {
10991102
Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
11001103

11011104
if (IsMasked)
1102-
IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
1105+
IntrinsicTypes = {ResultType, Ops[Offset]->getType(),
1106+
Ops[Offset + 1]->getType(),
11031107
Ops[0]->getType(),
11041108
Ops.back()->getType()};
11051109
else
1106-
IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
1110+
IntrinsicTypes = {ResultType, Ops[Offset]->getType(),
1111+
Ops[Offset + 1]->getType(),
11071112
Ops.back()->getType()};
11081113
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
11091114
llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
@@ -1160,11 +1165,11 @@ multiclass RVVIndexedSegStoreTuple<string op> {
11601165
Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
11611166

11621167
if (IsMasked)
1163-
IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
1168+
IntrinsicTypes = {Operands[0]->getType(), Ops[Offset]->getType(), Ops[Offset + 1]->getType(),
11641169
Ops[0]->getType(),
11651170
Operands.back()->getType()};
11661171
else
1167-
IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
1172+
IntrinsicTypes = {Operands[0]->getType(), Ops[Offset]->getType(), Ops[Offset + 1]->getType(),
11681173
Operands.back()->getType()};
11691174
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
11701175
return Builder.CreateCall(F, Operands, "");

clang/include/clang/Basic/riscv_vector_common.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ class RVVOp0Builtin<string suffix, string prototype, string type_range>
266266
let IntrinsicTypes = [0];
267267
}
268268

269+
class RVVOutOp0Builtin<string suffix, string prototype, string type_range>
270+
: RVVBuiltin<suffix, prototype, type_range> {
271+
let IntrinsicTypes = [-1, 0];
272+
}
273+
269274
class RVVOutOp1Builtin<string suffix, string prototype, string type_range>
270275
: RVVBuiltin<suffix, prototype, type_range> {
271276
let IntrinsicTypes = [-1, 1];

0 commit comments

Comments
 (0)