Skip to content

Commit f617993

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-explicit-unpack
2 parents 26d2add + f8baf07 commit f617993

File tree

259 files changed

+6850
-4761
lines changed

Some content is hidden

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

259 files changed

+6850
-4761
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ jobs:
255255
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
256256
- name: Install dependencies
257257
run: |
258-
choco install -y ninja
259258
pip install psutil
260259
- name: Install a current LLVM
261260
if: ${{ matrix.mingw != true }}

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ AST Dumping Potentially Breaking Changes
123123

124124
``__atomic_test_and_set(p, 0)``
125125

126+
- Pretty-printing of templates with inherited (i.e. specified in a previous
127+
redeclaration) default arguments has been fixed.
128+
126129
Clang Frontend Potentially Breaking Changes
127130
-------------------------------------------
128131
- Members of anonymous unions/structs are now injected as ``IndirectFieldDecl``
@@ -250,6 +253,8 @@ Non-comprehensive list of changes in this release
250253

251254
- ``__builtin_assume_dereferenceable`` now accepts non-constant size operands.
252255

256+
- Fixed a crash when the second argument to ``__builtin_assume_aligned`` was not constant (#GH161314)
257+
253258
New Compiler Flags
254259
------------------
255260
- New option ``-fno-sanitize-debug-trap-reasons`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).
@@ -452,6 +457,7 @@ Bug Fixes to AST Handling
452457

453458
Miscellaneous Bug Fixes
454459
^^^^^^^^^^^^^^^^^^^^^^^
460+
- Fixed missing diagnostics of ``diagnose_if`` on templates involved in initialization. (#GH160776)
455461

456462
Miscellaneous Clang Crashes Fixed
457463
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/BuiltinsNVPTX.td

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,35 @@ def __nvvm_ff2bf16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)
579579
def __nvvm_ff2bf16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
580580
def __nvvm_ff2bf16x2_rz : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
581581
def __nvvm_ff2bf16x2_rz_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float)", SM_80, PTX70>;
582+
def __nvvm_ff2bf16x2_rs :
583+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
584+
SM<"100a", [SM_103a]>, PTX87>;
585+
def __nvvm_ff2bf16x2_rs_relu :
586+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
587+
SM<"100a", [SM_103a]>, PTX87>;
588+
def __nvvm_ff2bf16x2_rs_satfinite :
589+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
590+
SM<"100a", [SM_103a]>, PTX87>;
591+
def __nvvm_ff2bf16x2_rs_relu_satfinite :
592+
NVPTXBuiltinSMAndPTX<"_Vector<2, __bf16>(float, float, uint32_t)",
593+
SM<"100a", [SM_103a]>, PTX87>;
582594

583595
def __nvvm_ff2f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
584596
def __nvvm_ff2f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
585597
def __nvvm_ff2f16x2_rz : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
586598
def __nvvm_ff2f16x2_rz_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float)", SM_80, PTX70>;
599+
def __nvvm_ff2f16x2_rs :
600+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
601+
SM<"100a", [SM_103a]>, PTX87>;
602+
def __nvvm_ff2f16x2_rs_relu :
603+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
604+
SM<"100a", [SM_103a]>, PTX87>;
605+
def __nvvm_ff2f16x2_rs_satfinite :
606+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
607+
SM<"100a", [SM_103a]>, PTX87>;
608+
def __nvvm_ff2f16x2_rs_relu_satfinite :
609+
NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(float, float, uint32_t)",
610+
SM<"100a", [SM_103a]>, PTX87>;
587611

588612
def __nvvm_f2bf16_rn : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
589613
def __nvvm_f2bf16_rn_relu : NVPTXBuiltinSMAndPTX<"__bf16(float)", SM_80, PTX70>;
@@ -616,6 +640,19 @@ def __nvvm_e4m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(sh
616640
def __nvvm_e5m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
617641
def __nvvm_e5m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM_89, PTX81>;
618642

643+
def __nvvm_f32x4_to_e4m3x4_rs_satfinite :
644+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
645+
SM<"100a", [SM_103a]>, PTX87>;
646+
def __nvvm_f32x4_to_e4m3x4_rs_relu_satfinite :
647+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
648+
SM<"100a", [SM_103a]>, PTX87>;
649+
def __nvvm_f32x4_to_e5m2x4_rs_satfinite :
650+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
651+
SM<"100a", [SM_103a]>, PTX87>;
652+
def __nvvm_f32x4_to_e5m2x4_rs_relu_satfinite :
653+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
654+
SM<"100a", [SM_103a]>, PTX87>;
655+
619656
def __nvvm_ff_to_e2m3x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
620657
def __nvvm_ff_to_e2m3x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
621658
def __nvvm_ff_to_e3m2x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
@@ -626,12 +663,32 @@ def __nvvm_e2m3x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(sh
626663
def __nvvm_e3m2x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
627664
def __nvvm_e3m2x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
628665

666+
def __nvvm_f32x4_to_e2m3x4_rs_satfinite :
667+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
668+
SM<"100a", [SM_103a]>, PTX87>;
669+
def __nvvm_f32x4_to_e2m3x4_rs_relu_satfinite :
670+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
671+
SM<"100a", [SM_103a]>, PTX87>;
672+
def __nvvm_f32x4_to_e3m2x4_rs_satfinite :
673+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
674+
SM<"100a", [SM_103a]>, PTX87>;
675+
def __nvvm_f32x4_to_e3m2x4_rs_relu_satfinite :
676+
NVPTXBuiltinSMAndPTX<"_Vector<4, char>(_Vector<4, float>, uint32_t)",
677+
SM<"100a", [SM_103a]>, PTX87>;
678+
629679
def __nvvm_ff_to_e2m1x2_rn_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
630680
def __nvvm_ff_to_e2m1x2_rn_relu_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
631681

632682
def __nvvm_e2m1x2_to_f16x2_rn : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
633683
def __nvvm_e2m1x2_to_f16x2_rn_relu : NVPTXBuiltinSMAndPTX<"_Vector<2, __fp16>(short)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
634684

685+
def __nvvm_f32x4_to_e2m1x4_rs_satfinite :
686+
NVPTXBuiltinSMAndPTX<"short(_Vector<4, float>, uint32_t)",
687+
SM<"100a", [SM_103a]>, PTX87>;
688+
def __nvvm_f32x4_to_e2m1x4_rs_relu_satfinite :
689+
NVPTXBuiltinSMAndPTX<"short(_Vector<4, float>, uint32_t)",
690+
SM<"100a", [SM_103a]>, PTX87>;
691+
635692
def __nvvm_ff_to_ue8m0x2_rz : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
636693
def __nvvm_ff_to_ue8m0x2_rz_satfinite : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;
637694
def __nvvm_ff_to_ue8m0x2_rp : NVPTXBuiltinSMAndPTX<"short(float, float)", SM<"100a", [SM_101a, SM_120a]>, PTX86>;

clang/include/clang/Basic/LangOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ LANGOPT(HLSLStrictAvailability, 1, 0, NotCompatible,
245245
LANGOPT(HLSLSpvUseUnknownImageFormat, 1, 0, NotCompatible, "For storage images and texel buffers, sets the default format to 'Unknown' when not specified via the `vk::image_format` attribute. If this option is not used, the format is inferred from the resource's data type.")
246246

247247
LANGOPT(CUDAIsDevice , 1, 0, NotCompatible, "compiling for CUDA device")
248-
LANGOPT(CUDAAllowVariadicFunctions, 1, 0, NotCompatible, "allowing variadic functions in CUDA device code")
249248
LANGOPT(CUDAHostDeviceConstexpr, 1, 1, NotCompatible, "treating unattributed constexpr functions as __host__ __device__")
250249
LANGOPT(GPUDeviceApproxTranscendentals, 1, 0, NotCompatible, "using approximate transcendental functions")
251250
LANGOPT(GPURelocatableDeviceCode, 1, 0, NotCompatible, "generate relocatable device code")

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8733,8 +8733,7 @@ def fcuda_include_gpubinary : Separate<["-"], "fcuda-include-gpubinary">,
87338733
HelpText<"Incorporate CUDA device-side binary into host object file.">,
87348734
MarshallingInfoString<CodeGenOpts<"CudaGpuBinaryFileName">>;
87358735
def fcuda_allow_variadic_functions : Flag<["-"], "fcuda-allow-variadic-functions">,
8736-
HelpText<"Allow variadic functions in CUDA device code.">,
8737-
MarshallingInfoFlag<LangOpts<"CUDAAllowVariadicFunctions">>;
8736+
HelpText<"Deprecated; Allow variadic functions in CUDA device code.">;
87388737
def fno_cuda_host_device_constexpr : Flag<["-"], "fno-cuda-host-device-constexpr">,
87398738
HelpText<"Don't treat unattributed constexpr functions as __host__ __device__.">,
87408739
MarshallingInfoNegativeFlag<LangOpts<"CUDAHostDeviceConstexpr">>;

clang/include/clang/Sema/SemaConcept.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ struct NormalizedConstraint {
257257
case ConstraintKind::FoldExpanded:
258258
return FoldExpanded.Pattern->getBeginLoc();
259259
}
260+
llvm_unreachable("Unknown ConstraintKind enum");
260261
}
261262

262263
SourceLocation getEndLoc() const {
@@ -270,6 +271,7 @@ struct NormalizedConstraint {
270271
case ConstraintKind::FoldExpanded:
271272
return FoldExpanded.Pattern->getEndLoc();
272273
}
274+
llvm_unreachable("Unknown ConstraintKind enum");
273275
}
274276

275277
SourceRange getSourceRange() const { return {getBeginLoc(), getEndLoc()}; }

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -736,25 +736,6 @@ static bool interp__builtin_expect(InterpState &S, CodePtr OpPC,
736736
return true;
737737
}
738738

739-
/// rotateleft(value, amount)
740-
static bool interp__builtin_rotate(InterpState &S, CodePtr OpPC,
741-
const InterpFrame *Frame,
742-
const CallExpr *Call, bool Right) {
743-
APSInt Amount = popToAPSInt(S, Call->getArg(1));
744-
APSInt Value = popToAPSInt(S, Call->getArg(0));
745-
746-
APSInt Result;
747-
if (Right)
748-
Result = APSInt(Value.rotr(Amount.urem(Value.getBitWidth())),
749-
/*IsUnsigned=*/true);
750-
else // Left.
751-
Result = APSInt(Value.rotl(Amount.urem(Value.getBitWidth())),
752-
/*IsUnsigned=*/true);
753-
754-
pushInteger(S, Result, Call->getType());
755-
return true;
756-
}
757-
758739
static bool interp__builtin_ffs(InterpState &S, CodePtr OpPC,
759740
const InterpFrame *Frame,
760741
const CallExpr *Call) {
@@ -2796,7 +2777,7 @@ static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC,
27962777
unsigned LaneBase = (Idx / LaneElts) * LaneElts;
27972778
unsigned LaneIdx = Idx % LaneElts;
27982779
unsigned SrcIdx = Idx;
2799-
unsigned Sel = (Ctl >> (2 * LaneIdx)) & 0x3;
2780+
unsigned Sel = (Ctl >> (2 * (LaneIdx & 0x3))) & 0x3;
28002781
if (ElemBits == 32) {
28012782
SrcIdx = LaneBase + Sel;
28022783
} else {
@@ -2805,8 +2786,6 @@ static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC,
28052786
if (!IsShufHW && !InHigh) {
28062787
SrcIdx = LaneBase + Sel;
28072788
} else if (IsShufHW && InHigh) {
2808-
unsigned Rel = LaneIdx - HalfSize;
2809-
Sel = (Ctl >> (2 * Rel)) & 0x3;
28102789
SrcIdx = LaneBase + HalfSize + Sel;
28112790
}
28122791
}
@@ -3162,7 +3141,10 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
31623141
case Builtin::BI_rotl:
31633142
case Builtin::BI_lrotl:
31643143
case Builtin::BI_rotl64:
3165-
return interp__builtin_rotate(S, OpPC, Frame, Call, /*Right=*/false);
3144+
return interp__builtin_elementwise_int_binop(
3145+
S, OpPC, Call, [](const APSInt &Value, const APSInt &Amount) -> APInt {
3146+
return Value.rotl(Amount);
3147+
});
31663148

31673149
case Builtin::BI__builtin_rotateright8:
31683150
case Builtin::BI__builtin_rotateright16:
@@ -3173,7 +3155,10 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
31733155
case Builtin::BI_rotr:
31743156
case Builtin::BI_lrotr:
31753157
case Builtin::BI_rotr64:
3176-
return interp__builtin_rotate(S, OpPC, Frame, Call, /*Right=*/true);
3158+
return interp__builtin_elementwise_int_binop(
3159+
S, OpPC, Call, [](const APSInt &Value, const APSInt &Amount) -> APInt {
3160+
return Value.rotr(Amount);
3161+
});
31773162

31783163
case Builtin::BI__builtin_ffs:
31793164
case Builtin::BI__builtin_ffsl:

clang/lib/AST/DeclPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ void DeclPrinter::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *TTP) {
18941894
Out << TTP->getDeclName();
18951895
}
18961896

1897-
if (TTP->hasDefaultArgument()) {
1897+
if (TTP->hasDefaultArgument() && !TTP->defaultArgumentWasInherited()) {
18981898
Out << " = ";
18991899
TTP->getDefaultArgument().getArgument().print(Policy, Out,
19001900
/*IncludeType=*/false);
@@ -1909,7 +1909,7 @@ void DeclPrinter::VisitNonTypeTemplateParmDecl(
19091909
Policy.CleanUglifiedParameters ? II->deuglifiedName() : II->getName();
19101910
printDeclType(NTTP->getType(), Name, NTTP->isParameterPack());
19111911

1912-
if (NTTP->hasDefaultArgument()) {
1912+
if (NTTP->hasDefaultArgument() && !NTTP->defaultArgumentWasInherited()) {
19131913
Out << " = ";
19141914
NTTP->getDefaultArgument().getArgument().print(Policy, Out,
19151915
/*IncludeType=*/false);

clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ class AggExprEmitter : public StmtVisitor<AggExprEmitter> {
201201
}
202202

203203
void VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *e) {
204-
cgf.cgm.errorNYI(e->getSourceRange(),
205-
"AggExprEmitter: VisitDesignatedInitUpdateExpr");
204+
AggValueSlot dest = ensureSlot(cgf.getLoc(e->getExprLoc()), e->getType());
205+
LValue destLV = cgf.makeAddrLValue(dest.getAddress(), e->getType());
206+
emitInitializationToLValue(e->getBase(), destLV);
207+
VisitInitListExpr(e->getUpdater());
206208
}
207209
void VisitAbstractConditionalOperator(const AbstractConditionalOperator *e) {
208210
cgf.cgm.errorNYI(e->getSourceRange(),

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,16 @@ class ScalarExprEmitter
465465
return nullptr;
466466

467467
if (Value *Result = ConstantEmitter(CGF).tryEmitConstantExpr(E)) {
468-
if (E->isGLValue())
468+
if (E->isGLValue()) {
469+
// This was already converted to an rvalue when it was constant
470+
// evaluated.
471+
if (E->hasAPValueResult() && !E->getAPValueResult().isLValue())
472+
return Result;
469473
return CGF.EmitLoadOfScalar(
470474
Address(Result, CGF.convertTypeForLoadStore(E->getType()),
471475
CGF.getContext().getTypeAlignInChars(E->getType())),
472476
/*Volatile*/ false, E->getType(), E->getExprLoc());
477+
}
473478
return Result;
474479
}
475480
return Visit(E->getSubExpr());

0 commit comments

Comments
 (0)