Skip to content

Commit f7f7744

Browse files
authored
Merge branch 'main' into sirish/swdev-502377
2 parents adce896 + 3d7e56f commit f7f7744

File tree

283 files changed

+22758
-3343
lines changed

Some content is hidden

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

283 files changed

+22758
-3343
lines changed

bolt/runtime/hugify.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===---------------------------------------------------------------------===//
88

9-
#if defined(__x86_64__) || \
10-
(defined(__aarch64__) || defined(__arm64__)) && !defined(__APPLE__)
9+
#if (defined(__x86_64__) || defined(__aarch64__) || defined(__arm64__)) && \
10+
!defined(__APPLE__)
1111

1212
#include "common.h"
1313

clang-tools-extra/clangd/ConfigFragment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ struct Fragment {
347347
/// "IWYU": Include what you use. Insert the owning header for top-level
348348
/// symbols, unless the header is already directly included or the
349349
/// symbol is forward-declared
350-
/// "NeverInsert": Never insert headers
350+
/// "Never": Never insert headers
351351
std::optional<Located<std::string>> HeaderInsertion;
352352
};
353353
CompletionBlock Completion;

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ set(LLVM_TOOLCHAIN_TOOLS
459459
llvm-libtool-darwin
460460
llvm-lipo
461461
llvm-ml
462-
llvm-mt
463462
llvm-nm
464463
llvm-objcopy
465464
llvm-objdump
@@ -481,6 +480,10 @@ set(LLVM_TOOLCHAIN_TOOLS
481480
scan-build-py
482481
CACHE STRING "")
483482

483+
if (LLVM_ENABLE_LIBXML2)
484+
list(APPEND LLVM_TOOLCHAIN_TOOLS llvm-mt)
485+
endif()
486+
484487
set(LLVM_Toolchain_DISTRIBUTION_COMPONENTS
485488
bolt
486489
clang

clang/docs/ReleaseNotes.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ Improvements to Clang's diagnostics
371371
372372
- An error is now emitted when a ``musttail`` call is made to a function marked with the ``not_tail_called`` attribute. (#GH133509).
373373

374+
- ``-Whigher-precisision-for-complex-divison`` warns when:
375+
376+
- The divisor is complex.
377+
- When the complex division happens in a higher precision type due to arithmetic promotion.
378+
- When using the divide and assign operator (``/=``).
379+
380+
Fixes #GH131127
381+
374382
Improvements to Clang's time-trace
375383
----------------------------------
376384

@@ -402,6 +410,7 @@ Bug Fixes in This Version
402410
when using the ``INTn_C`` macros. (#GH85995)
403411
- Fixed an assertion failure in the expansion of builtin macros like ``__has_embed()`` with line breaks before the
404412
closing paren. (#GH133574)
413+
- Fixed a crash in error recovery for expressions resolving to templates. (#GH135621)
405414
- Clang no longer accepts invalid integer constants which are too large to fit
406415
into any (standard or extended) integer type when the constant is unevaluated.
407416
Merely forming the token is sufficient to render the program invalid. Code
@@ -457,7 +466,6 @@ Bug Fixes to C++ Support
457466
by template argument deduction.
458467
- Clang is now better at instantiating the function definition after its use inside
459468
of a constexpr lambda. (#GH125747)
460-
- Fixed a local class member function instantiation bug inside dependent lambdas. (#GH59734), (#GH132208)
461469
- Clang no longer crashes when trying to unify the types of arrays with
462470
certain differences in qualifiers (this could happen during template argument
463471
deduction or when building a ternary operator). (#GH97005)
@@ -545,7 +553,7 @@ Arm and AArch64 Support
545553
^^^^^^^^^^^^^^^^^^^^^^^
546554
- For ARM targets, cc1as now considers the FPU's features for the selected CPU or Architecture.
547555
- The ``+nosimd`` attribute is now fully supported for ARM. Previously, this had no effect when being used with
548-
ARM targets, however this will now disable NEON instructions being generated. The ``simd`` option is
556+
ARM targets, however this will now disable NEON instructions being generated. The ``simd`` option is
549557
also now printed when the ``--print-supported-extensions`` option is used.
550558

551559
- Support for __ptrauth type qualifier has been added.

clang/include/clang/AST/OpenACCClause.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ class OpenACCSelfClause final
430430
}
431431

432432
bool isConditionExprClause() const { return HasConditionExpr.has_value(); }
433+
bool isVarListClause() const { return !isConditionExprClause(); }
434+
bool isEmptySelfClause() const {
435+
return (isConditionExprClause() && !hasConditionExpr()) ||
436+
(!isConditionExprClause() && getVarList().empty());
437+
}
433438

434439
bool hasConditionExpr() const {
435440
assert(HasConditionExpr.has_value() &&

clang/include/clang/Basic/BuiltinsNVPTX.td

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,15 @@ def __nvvm_f2bf16_rz : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
580580
def __nvvm_f2bf16_rz_relu : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
581581

582582
def __nvvm_f2tf32_rna : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_80, PTX70>;
583+
def __nvvm_f2tf32_rna_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_89, PTX81>;
584+
def __nvvm_f2tf32_rn : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_90, PTX78>;
585+
def __nvvm_f2tf32_rn_relu : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_90, PTX78>;
586+
def __nvvm_f2tf32_rn_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_100, PTX86>;
587+
def __nvvm_f2tf32_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_100, PTX86>;
588+
def __nvvm_f2tf32_rz : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_90, PTX78>;
589+
def __nvvm_f2tf32_rz_relu : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_90, PTX78>;
590+
def __nvvm_f2tf32_rz_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_100, PTX86>;
591+
def __nvvm_f2tf32_rz_relu_satfinite : NVPTXBuiltinSMAndPTX<"int32_t(float)", SM_100, PTX86>;
583592

584593
def __nvvm_ff_to_e4m3x2_rn : NVPTXBuiltinSMAndPTX<"short(float, float)", SM_89, PTX81>;
585594
def __nvvm_ff_to_e4m3x2_rn_relu : NVPTXBuiltinSMAndPTX<"short(float, float)", SM_89, PTX81>;
@@ -596,6 +605,28 @@ def __nvvm_e4m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(sh
596605
def __nvvm_e5m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
597606
def __nvvm_e5m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
598607

608+
def __nvvm_ff_to_e2m3x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
609+
def __nvvm_ff_to_e2m3x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
610+
def __nvvm_ff_to_e3m2x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
611+
def __nvvm_ff_to_e3m2x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
612+
613+
def __nvvm_e2m3x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
614+
def __nvvm_e2m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
615+
def __nvvm_e3m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
616+
def __nvvm_e3m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
617+
618+
def __nvvm_ff_to_ue8m0x2_rz : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
619+
def __nvvm_ff_to_ue8m0x2_rz_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
620+
def __nvvm_ff_to_ue8m0x2_rp : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
621+
def __nvvm_ff_to_ue8m0x2_rp_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
622+
623+
def __nvvm_bf16x2_to_ue8m0x2_rz : NVPTXBuiltinSMAndPTX<"short(_Vector<2, __bf16>)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
624+
def __nvvm_bf16x2_to_ue8m0x2_rz_satfinite : NVPTXBuiltinSMAndPTX<"short(_Vector<2, __bf16>)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
625+
def __nvvm_bf16x2_to_ue8m0x2_rp : NVPTXBuiltinSMAndPTX<"short(_Vector<2, __bf16>)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
626+
def __nvvm_bf16x2_to_ue8m0x2_rp_satfinite : NVPTXBuiltinSMAndPTX<"short(_Vector<2, __bf16>)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
627+
628+
def __nvvm_ue8m0x2_to_bf16x2 : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
629+
599630
// FNS
600631
let Attributes = [NoThrow] in {
601632
def __nvvm_fns : NVPTXBuiltinPTX<"unsigned int(unsigned int, unsigned int, int)", PTX60>;

clang/include/clang/Basic/arm_sme.td

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,33 @@ let SMETargetGuard = "sme-f16f16" in {
907907
}
908908

909909

910+
////////////////////////////////////////////////////////////////////////////////
911+
// SME2 - TMOP, SUTMOP, USTMOP
912+
913+
let SMETargetGuard = "sme2,sme-tmop" in {
914+
def SVTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{d}]", "vi2d[i", "hbf", MergeNone, "aarch64_sme_ftmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
915+
def SVSTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{d}]", "vi2d[i", "cs", MergeNone, "aarch64_sme_stmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
916+
def SVUTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{d}]", "vi2d[i", "UcUs", MergeNone, "aarch64_sme_utmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
917+
def SVSUTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{3}]", "vi2u[i", "c", MergeNone, "aarch64_sme_sutmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
918+
def SVUSTMOPA_ZA32 : Inst<"svtmopa_lane_za32[_{d}_{3}]", "vi2x[i", "Uc", MergeNone, "aarch64_sme_ustmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
919+
}
920+
921+
let SMETargetGuard = "sme2,sme-tmop,sme-f16f16" in {
922+
def SVTMOPA_F16 : Inst<"svtmopa_lane_za16[_{d}_{d}]", "vi2d[i", "h", MergeNone, "aarch64_sme_ftmopa_za16", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_1>, ImmCheck<4, ImmCheck0_3>]>;
923+
}
924+
925+
let SMETargetGuard = "sme2,sme-tmop,sme-b16b16" in {
926+
def SVTMOPA_BF16 : Inst<"svtmopa_lane_za16[_{d}_{d}]", "vi2d[i", "b", MergeNone, "aarch64_sme_ftmopa_za16", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_1>, ImmCheck<4, ImmCheck0_3>]>;
927+
}
928+
929+
let SMETargetGuard = "sme2,sme-tmop,sme-f8f16" in {
930+
def SVTMOPA_ZA16_FPM : Inst<"svtmopa_lane_za16[_{d}_{d}]", "vi2.dd[i>", "m", MergeNone, "aarch64_sme_ftmopa_za16", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_1>, ImmCheck<4, ImmCheck0_3>]>;
931+
}
932+
933+
let SMETargetGuard = "sme2,sme-tmop,sme-f8f32" in {
934+
def SVTMOPA_ZA32_FPM : Inst<"svtmopa_lane_za32[_{d}_{d}]", "vi2.dd[i>", "m", MergeNone, "aarch64_sme_ftmopa_za32", [IsStreaming, IsInOutZA], [ImmCheck<0, ImmCheck0_3>, ImmCheck<4, ImmCheck0_3>]>;
935+
}
936+
910937
multiclass ZAReadz<string n_suffix, string vg_num, string t, string i_prefix, list<ImmCheck> ch> {
911938
let SMETargetGuard = "sme2p1" in {
912939
def NAME # _H : SInst<"svreadz_hor_" # n_suffix # "_{d}_vg" # vg_num, vg_num # "im", t,

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4293,7 +4293,8 @@ bool Compiler<Emitter>::emitConst(const APSInt &Value, const Expr *E) {
42934293

42944294
template <class Emitter>
42954295
unsigned Compiler<Emitter>::allocateLocalPrimitive(
4296-
DeclTy &&Src, PrimType Ty, bool IsConst, const ValueDecl *ExtendingDecl) {
4296+
DeclTy &&Src, PrimType Ty, bool IsConst, const ValueDecl *ExtendingDecl,
4297+
bool IsConstexprUnknown) {
42974298
// Make sure we don't accidentally register the same decl twice.
42984299
if (const auto *VD =
42994300
dyn_cast_if_present<ValueDecl>(Src.dyn_cast<const Decl *>())) {
@@ -4307,6 +4308,7 @@ unsigned Compiler<Emitter>::allocateLocalPrimitive(
43074308
// or isa<MaterializeTemporaryExpr>().
43084309
Descriptor *D = P.createDescriptor(Src, Ty, nullptr, Descriptor::InlineDescMD,
43094310
IsConst, isa<const Expr *>(Src));
4311+
D->IsConstexprUnknown = IsConstexprUnknown;
43104312
Scope::Local Local = this->createLocal(D);
43114313
if (auto *VD = dyn_cast_if_present<ValueDecl>(Src.dyn_cast<const Decl *>()))
43124314
Locals.insert({VD, Local});
@@ -4320,7 +4322,8 @@ unsigned Compiler<Emitter>::allocateLocalPrimitive(
43204322
template <class Emitter>
43214323
std::optional<unsigned>
43224324
Compiler<Emitter>::allocateLocal(DeclTy &&Src, QualType Ty,
4323-
const ValueDecl *ExtendingDecl) {
4325+
const ValueDecl *ExtendingDecl,
4326+
bool IsConstexprUnknown) {
43244327
// Make sure we don't accidentally register the same decl twice.
43254328
if ([[maybe_unused]] const auto *VD =
43264329
dyn_cast_if_present<ValueDecl>(Src.dyn_cast<const Decl *>())) {
@@ -4349,6 +4352,7 @@ Compiler<Emitter>::allocateLocal(DeclTy &&Src, QualType Ty,
43494352
IsTemporary, /*IsMutable=*/false, Init);
43504353
if (!D)
43514354
return std::nullopt;
4355+
D->IsConstexprUnknown = IsConstexprUnknown;
43524356

43534357
Scope::Local Local = this->createLocal(D);
43544358
if (Key)
@@ -4460,9 +4464,10 @@ bool Compiler<Emitter>::visitExpr(const Expr *E, bool DestroyToplevelScope) {
44604464
}
44614465

44624466
template <class Emitter>
4463-
VarCreationState Compiler<Emitter>::visitDecl(const VarDecl *VD) {
4467+
VarCreationState Compiler<Emitter>::visitDecl(const VarDecl *VD,
4468+
bool IsConstexprUnknown) {
44644469

4465-
auto R = this->visitVarDecl(VD, /*Toplevel=*/true);
4470+
auto R = this->visitVarDecl(VD, /*Toplevel=*/true, IsConstexprUnknown);
44664471

44674472
if (R.notCreated())
44684473
return R;
@@ -4550,7 +4555,8 @@ bool Compiler<Emitter>::visitDeclAndReturn(const VarDecl *VD,
45504555

45514556
template <class Emitter>
45524557
VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
4553-
bool Toplevel) {
4558+
bool Toplevel,
4559+
bool IsConstexprUnknown) {
45544560
// We don't know what to do with these, so just return false.
45554561
if (VD->getType().isNull())
45564562
return false;
@@ -4620,7 +4626,8 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
46204626

46214627
if (VarT) {
46224628
unsigned Offset = this->allocateLocalPrimitive(
4623-
VD, *VarT, VD->getType().isConstQualified());
4629+
VD, *VarT, VD->getType().isConstQualified(), nullptr,
4630+
IsConstexprUnknown);
46244631
if (Init) {
46254632
// If this is a toplevel declaration, create a scope for the
46264633
// initializer.
@@ -4636,7 +4643,8 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
46364643
}
46374644
}
46384645
} else {
4639-
if (std::optional<unsigned> Offset = this->allocateLocal(VD)) {
4646+
if (std::optional<unsigned> Offset = this->allocateLocal(
4647+
VD, VD->getType(), nullptr, IsConstexprUnknown)) {
46404648
if (!Init)
46414649
return true;
46424650

@@ -6461,7 +6469,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
64616469

64626470
// In case we need to re-visit a declaration.
64636471
auto revisit = [&](const VarDecl *VD) -> bool {
6464-
auto VarState = this->visitDecl(VD);
6472+
auto VarState = this->visitDecl(VD, /*IsConstexprUnknown=*/true);
64656473

64666474
if (VarState.notCreated())
64676475
return true;

clang/lib/AST/ByteCode/Compiler.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,10 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
286286
/// intact.
287287
bool delegate(const Expr *E);
288288
/// Creates and initializes a variable from the given decl.
289-
VarCreationState visitVarDecl(const VarDecl *VD, bool Toplevel = false);
290-
VarCreationState visitDecl(const VarDecl *VD);
289+
VarCreationState visitVarDecl(const VarDecl *VD, bool Toplevel = false,
290+
bool IsConstexprUnknown = false);
291+
VarCreationState visitDecl(const VarDecl *VD,
292+
bool IsConstexprUnknown = false);
291293
/// Visit an APValue.
292294
bool visitAPValue(const APValue &Val, PrimType ValType, const Expr *E);
293295
bool visitAPValueInitializer(const APValue &Val, const Expr *E, QualType T);
@@ -303,12 +305,14 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
303305

304306
/// Creates a local primitive value.
305307
unsigned allocateLocalPrimitive(DeclTy &&Decl, PrimType Ty, bool IsConst,
306-
const ValueDecl *ExtendingDecl = nullptr);
308+
const ValueDecl *ExtendingDecl = nullptr,
309+
bool IsConstexprUnknown = false);
307310

308311
/// Allocates a space storing a local given its type.
309312
std::optional<unsigned>
310313
allocateLocal(DeclTy &&Decl, QualType Ty = QualType(),
311-
const ValueDecl *ExtendingDecl = nullptr);
314+
const ValueDecl *ExtendingDecl = nullptr,
315+
bool IsConstexprUnknown = false);
312316
std::optional<unsigned> allocateTemporary(const Expr *E);
313317

314318
private:

clang/lib/AST/ByteCode/Descriptor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct Descriptor final {
168168
const bool IsArray = false;
169169
/// Flag indicating if this is a dummy descriptor.
170170
bool IsDummy = false;
171+
bool IsConstexprUnknown = false;
171172

172173
/// Storage management methods.
173174
const BlockCtorFn CtorFn = nullptr;

0 commit comments

Comments
 (0)