Skip to content

[AutoBump] Merge with d70f54f2 (Jan 20) (7) #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c0055ec
[mlir][EmitC] Add MathToEmitC pass for math function lowering to Emit…
recursion-man Jan 20, 2025
d0c9e70
[MLIR][LLVM] Improve inlining debug information (#123520)
gysit Jan 20, 2025
333562e
[LoongArch] Avoid compilation warning. NFC (#123553)
zhaoqi5 Jan 20, 2025
754ed95
[Mips] Fix compiler crash when returning fp128 after calling a functi…
yingopq Jan 20, 2025
0b1ae89
[AutoUpgrade] Avoid unnecessary pointer bitcasts (NFCI)
nikic Jan 20, 2025
6f0a627
[Clang] Correctly propagate type aliases' unexpanded flags up to lamb…
zyn0217 Jan 20, 2025
d049db8
[clang] Fix false warning on reinterpret_casting unknown template typ…
necto Jan 20, 2025
1297c11
[mlir] Add `[[lifetimebound]]` to Range classes. (#123091)
chsigg Jan 20, 2025
4b3c178
[Offload] Enable shared-libs; compiler-rt as default RTLIB (#123568)
jplehr Jan 20, 2025
1be64c2
[clang][bytecode] Fix diagnostic mismatch with current interpreter (#…
tbaederr Jan 20, 2025
5139c90
[LLParser] Avoid PointerType::get() with type argument (NFC)
nikic Jan 20, 2025
5a7a324
[clang][NFC] Migrate bit-fields of OverloadCandidate to LLVM_PREFERRE…
Endilll Jan 20, 2025
a16adaf
[LLD][COFF] Add support for alternate entry point in CHPE metadata on…
cjacek Jan 20, 2025
0f8297a
[bazel] Fix dependencies for 69d3ba3db922fca8cfc47b5f115b6bea6a737aab
d0k Jan 20, 2025
96c4f97
[AMDGPU][NewPM] Port SIOptimizeExecMasking to NPM (#123572)
optimisan Jan 20, 2025
fe7cb15
[SPIR-V] Improve portability of the code (#123584)
VyacheslavLevytskyy Jan 20, 2025
8b7bfb4
[libclc] Rename include guards. NFC.
frasercrmck Jan 20, 2025
3ace18d
[CodeGen] MachineFunctionSplitter: Add missing initializer (#123564)
optimisan Jan 20, 2025
4d21096
[Flang] Modify module test to run in a sub-directory (#123364)
kiranchandramohan Jan 20, 2025
2d6d476
[Polly][CMake] Fix exports (#122123)
nikic Jan 20, 2025
bd96295
[Clang] Use more liberal pointer attribute wildcard in ms-intrinsics …
nikic Jan 20, 2025
a4d9a8d
[Clang] Don't match irrelevant attributes in mips return tests (NFC)
nikic Jan 20, 2025
27a2d3d
[AArch64] Build v2i64 Mul cost out of getArithmeticInstrCost and getV…
davemgreen Jan 20, 2025
a79ae86
[Clang] Regenerate test checks (NFC)
nikic Jan 20, 2025
af91372
[flang][debug] Improve handling of cyclic derived types. (#122770)
abidh Jan 20, 2025
0ec153b
[flang][debug] Remove an unused function to fix build. (#123602)
abidh Jan 20, 2025
d70f54f
[clang][bytecode] Fix reporting failed local constexpr initializers (…
tbaederr Jan 20, 2025
5ce271e
[MLIR] TosaToLinalgNamed: Lower unsigned tosa.max_pool2d (#123290)
mgehre-amd Jan 20, 2025
d9f165d
[SDAG] Add an ISD node to help lower vector.extract.last.active (#118…
huntergr-arm Jan 20, 2025
1c5b122
[NVPTX][DEBUGINFO][NFC]Reduce test file to ease maintenance
alexey-bataev Jan 20, 2025
456ec1c
[LoopInterchange] Remove 'S' Scalar Dependencies (#119345)
sjoerdmeijer Jan 20, 2025
57466db
[win/asan] GetInstructionSize: Support some more 3 byte instructions.…
bernhardu Jan 20, 2025
e334e21
[AutoBump] Merge with d70f54f2 (Jan 20)
jorickert May 20, 2025
6095dd5
[AutoBump] Merge with fixes of 5ce271ef (Jan 20)
jorickert May 20, 2025
e6c513d
[AutoBump] Merge with 57466db7 (Jan 20)
jorickert May 20, 2025
540639b
Merge pull request #546 from Xilinx/bump_to_5ce271ef
jorickert Jun 26, 2025
cd1fe65
Merge pull request #547 from Xilinx/bump_to_57466db7
jorickert Jun 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ Improvements to Clang's diagnostics

- Don't emit bogus dangling diagnostics when ``[[gsl::Owner]]`` and `[[clang::lifetimebound]]` are used together (#GH108272).

- Don't emit bogus dignostic about an undefined behavior on ``reinterpret_cast<T>`` for non-instantiated template functions without sufficient knowledge whether it can actually lead to undefined behavior for ``T`` (#GH109430).

- The ``-Wreturn-stack-address`` warning now also warns about addresses of
local variables passed to function calls using the ``[[clang::musttail]]``
attribute.
Expand Down Expand Up @@ -860,7 +862,7 @@ Bug Fixes to C++ Support
module imports in those situations. (#GH60336)
- Fix init-capture packs having a size of one before being instantiated. (#GH63677)
- Clang now preserves the unexpanded flag in a lambda transform used for pack expansion. (#GH56852), (#GH85667),
(#GH99877).
(#GH99877), (#GH122417).
- Fixed a bug when diagnosing ambiguous explicit specializations of constrained member functions.
- Fixed an assertion failure when selecting a function from an overload set that includes a
specialization of a conversion function template.
Expand Down
21 changes: 14 additions & 7 deletions clang/include/clang/Sema/Overload.h
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,8 @@ class Sema;
ConversionFixItGenerator Fix;

/// Viable - True to indicate that this overload candidate is viable.
bool Viable : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned Viable : 1;

/// Whether this candidate is the best viable function, or tied for being
/// the best viable function.
Expand All @@ -907,12 +908,14 @@ class Sema;
/// was part of the ambiguity kernel: the minimal non-empty set of viable
/// candidates such that all elements of the ambiguity kernel are better
/// than all viable candidates not in the ambiguity kernel.
bool Best : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned Best : 1;

/// IsSurrogate - True to indicate that this candidate is a
/// surrogate for a conversion to a function pointer or reference
/// (C++ [over.call.object]).
bool IsSurrogate : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned IsSurrogate : 1;

/// IgnoreObjectArgument - True to indicate that the first
/// argument's conversion, which for this function represents the
Expand All @@ -921,12 +924,15 @@ class Sema;
/// implicit object argument is just a placeholder) or a
/// non-static member function when the call doesn't have an
/// object argument.
bool IgnoreObjectArgument : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned IgnoreObjectArgument : 1;

bool TookAddressOfOverload : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned TookAddressOfOverload : 1;

/// True if the candidate was found using ADL.
CallExpr::ADLCallKind IsADLCandidate : 1;
LLVM_PREFERRED_TYPE(CallExpr::ADLCallKind)
unsigned IsADLCandidate : 1;

/// Whether this is a rewritten candidate, and if so, of what kind?
LLVM_PREFERRED_TYPE(OverloadCandidateRewriteKind)
Expand Down Expand Up @@ -999,7 +1005,8 @@ class Sema;
friend class OverloadCandidateSet;
OverloadCandidate()
: IsSurrogate(false), IgnoreObjectArgument(false),
TookAddressOfOverload(false), IsADLCandidate(CallExpr::NotADL),
TookAddressOfOverload(false),
IsADLCandidate(llvm::to_underlying(CallExpr::NotADL)),
RewriteKind(CRK_None) {}
};

Expand Down
12 changes: 7 additions & 5 deletions clang/lib/AST/ByteCode/Interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ bool CheckLive(InterpState &S, CodePtr OpPC, const Pointer &Ptr,

if (Ptr.isDynamic()) {
S.FFDiag(Src, diag::note_constexpr_access_deleted_object) << AK;
} else {
} else if (!S.checkingPotentialConstantExpression()) {
bool IsTemp = Ptr.isTemporary();
S.FFDiag(Src, diag::note_constexpr_lifetime_ended, 1) << AK << !IsTemp;

Expand Down Expand Up @@ -416,9 +416,11 @@ bool CheckRange(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
AccessKinds AK) {
if (!Ptr.isOnePastEnd())
return true;
const SourceInfo &Loc = S.Current->getSource(OpPC);
S.FFDiag(Loc, diag::note_constexpr_access_past_end)
<< AK << S.Current->getRange(OpPC);
if (S.getLangOpts().CPlusPlus) {
const SourceInfo &Loc = S.Current->getSource(OpPC);
S.FFDiag(Loc, diag::note_constexpr_access_past_end)
<< AK << S.Current->getRange(OpPC);
}
return false;
}

Expand Down Expand Up @@ -538,7 +540,7 @@ bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
return true;

if (const auto *VD = Ptr.getDeclDesc()->asVarDecl();
VD && VD->hasGlobalStorage()) {
VD && (VD->isConstexpr() || VD->hasGlobalStorage())) {
const SourceInfo &Loc = S.Current->getSource(OpPC);
if (VD->getAnyInitializer()) {
S.FFDiag(Loc, diag::note_constexpr_var_init_non_constant, 1) << VD;
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Sema/SemaCast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2094,6 +2094,10 @@ void Sema::CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
}
}

if (SrcTy->isDependentType() || DestTy->isDependentType()) {
return;
}

Diag(Range.getBegin(), DiagID) << SrcType << DestType << Range;
}

Expand Down
16 changes: 10 additions & 6 deletions clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6977,7 +6977,7 @@ void Sema::AddOverloadCandidate(
Candidate.Viable = true;
Candidate.RewriteKind =
CandidateSet.getRewriteInfo().getRewriteKind(Function, PO);
Candidate.IsADLCandidate = IsADLCandidate;
Candidate.IsADLCandidate = llvm::to_underlying(IsADLCandidate);
Candidate.ExplicitCallArguments = Args.size();

// Explicit functions are not actually candidates at all if we're not
Expand Down Expand Up @@ -7832,7 +7832,7 @@ void Sema::AddTemplateOverloadCandidate(
Candidate.RewriteKind =
CandidateSet.getRewriteInfo().getRewriteKind(Candidate.Function, PO);
Candidate.IsSurrogate = false;
Candidate.IsADLCandidate = IsADLCandidate;
Candidate.IsADLCandidate = llvm::to_underlying(IsADLCandidate);
// Ignore the object argument if there is one, since we don't have an object
// type.
Candidate.IgnoreObjectArgument =
Expand Down Expand Up @@ -14082,7 +14082,8 @@ static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
return ExprError();
return SemaRef.BuildResolvedCallExpr(
Res.get(), FDecl, LParenLoc, Args, RParenLoc, ExecConfig,
/*IsExecConfig=*/false, (*Best)->IsADLCandidate);
/*IsExecConfig=*/false,
static_cast<CallExpr::ADLCallKind>((*Best)->IsADLCandidate));
}

case OR_No_Viable_Function: {
Expand Down Expand Up @@ -14156,7 +14157,8 @@ static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
return ExprError();
return SemaRef.BuildResolvedCallExpr(
Res.get(), FDecl, LParenLoc, Args, RParenLoc, ExecConfig,
/*IsExecConfig=*/false, (*Best)->IsADLCandidate);
/*IsExecConfig=*/false,
static_cast<CallExpr::ADLCallKind>((*Best)->IsADLCandidate));
}
}

Expand Down Expand Up @@ -14438,7 +14440,8 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
Args[0] = Input;
CallExpr *TheCall = CXXOperatorCallExpr::Create(
Context, Op, FnExpr.get(), ArgsArray, ResultTy, VK, OpLoc,
CurFPFeatureOverrides(), Best->IsADLCandidate);
CurFPFeatureOverrides(),
static_cast<CallExpr::ADLCallKind>(Best->IsADLCandidate));

if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall, FnDecl))
return ExprError();
Expand Down Expand Up @@ -14833,7 +14836,8 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// members; CodeGen should take care not to emit the this pointer.
TheCall = CXXOperatorCallExpr::Create(
Context, ChosenOp, FnExpr.get(), Args, ResultTy, VK, OpLoc,
CurFPFeatureOverrides(), Best->IsADLCandidate);
CurFPFeatureOverrides(),
static_cast<CallExpr::ADLCallKind>(Best->IsADLCandidate));

if (const auto *Method = dyn_cast<CXXMethodDecl>(FnDecl);
Method && Method->isImplicitObjectMemberFunction()) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -8499,7 +8499,7 @@ TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
getSema()
.getASTContext()
.getTypeDeclType(TD)
.getCanonicalType()
.getSingleStepDesugaredType(getSema().getASTContext())
->containsUnexpandedParameterPack();

if (auto *VD = dyn_cast<VarDecl>(Transformed))
Expand Down
8 changes: 8 additions & 0 deletions clang/test/AST/ByteCode/c23.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,11 @@ static_assert(arg1[1] == 254);
static_assert(arg1[2] == 186);
static_assert(arg1[3] == 190);
#endif

void ghissue109095() {
constexpr char c[] = { 'a' };
constexpr int i = c[1]; // both-error {{constexpr variable 'i' must be initialized by a constant expression}}\
// both-note {{declared here}}
_Static_assert(i == c[0]); // both-error {{static assertion expression is not an integral constant expression}}\
// both-note {{initializer of 'i' is not a constant expression}}
}
6 changes: 3 additions & 3 deletions clang/test/AST/ByteCode/lifetimes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ struct Foo {
int a;
};

constexpr int dead1() { // expected-error {{never produces a constant expression}}
constexpr int dead1() {

Foo *F2 = nullptr;
{
Foo F{12}; // expected-note 2{{declared here}}
Foo F{12}; // expected-note {{declared here}}
F2 = &F;
} // Ends lifetime of F.

return F2->a; // expected-note 2{{read of variable whose lifetime has ended}} \
return F2->a; // expected-note {{read of variable whose lifetime has ended}} \
// ref-note {{read of object outside its lifetime is not allowed in a constant expression}}
}
static_assert(dead1() == 1, ""); // both-error {{not an integral constant expression}} \
Expand Down
9 changes: 9 additions & 0 deletions clang/test/AST/ByteCode/literals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,3 +1315,12 @@ namespace {
}
}
#endif

void localConstexpr() {
constexpr int a = 1/0; // both-error {{must be initialized by a constant expression}} \
// both-note {{division by zero}} \
// both-warning {{division by zero is undefined}} \
// both-note {{declared here}}
static_assert(a == 0, ""); // both-error {{not an integral constant expression}} \
// both-note {{initializer of 'a' is not a constant expression}}
}
4 changes: 2 additions & 2 deletions clang/test/CodeGen/X86/ms-x86-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ __int64 test_mul128(__int64 Multiplier,
__int64 *HighProduct) {
return _mul128(Multiplier, Multiplicand, HighProduct);
}
// CHECK-X64-LABEL: define dso_local i64 @test_mul128(i64 noundef %Multiplier, i64 noundef %Multiplicand, ptr{{[a-z_ ]*}} initializes((0, 8)) %HighProduct)
// CHECK-X64-LABEL: define dso_local i64 @test_mul128(i64 noundef %Multiplier, i64 noundef %Multiplicand, ptr{{.*}} initializes((0, 8)) %HighProduct)
// CHECK-X64: = sext i64 %Multiplier to i128
// CHECK-X64: = sext i64 %Multiplicand to i128
// CHECK-X64: = mul nsw i128 %
Expand All @@ -183,7 +183,7 @@ unsigned __int64 test_umul128(unsigned __int64 Multiplier,
unsigned __int64 *HighProduct) {
return _umul128(Multiplier, Multiplicand, HighProduct);
}
// CHECK-X64-LABEL: define dso_local i64 @test_umul128(i64 noundef %Multiplier, i64 noundef %Multiplicand, ptr{{[a-z_ ]*}} initializes((0, 8)) %HighProduct)
// CHECK-X64-LABEL: define dso_local i64 @test_umul128(i64 noundef %Multiplier, i64 noundef %Multiplicand, ptr{{.*}} initializes((0, 8)) %HighProduct)
// CHECK-X64: = zext i64 %Multiplier to i128
// CHECK-X64: = zext i64 %Multiplicand to i128
// CHECK-X64: = mul nuw i128 %
Expand Down
25 changes: 17 additions & 8 deletions clang/test/CodeGen/attr-counted-by-pr110385.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ void init(void * __attribute__((pass_dynamic_object_size(0))));
// CHECK-NEXT: [[GROWABLE:%.*]] = getelementptr inbounds nuw i8, ptr [[FOO]], i64 8
// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[GROWABLE]], align 8, !tbaa [[TBAA2:![0-9]+]]
// CHECK-NEXT: [[ARRAY:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP0]], i64 12
// CHECK-NEXT: [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP0]], i64 8
// CHECK-NEXT: [[DOT_COUNTED_BY_LOAD:%.*]] = load i32, ptr [[DOT_COUNTED_BY_GEP]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[DOT_COUNTED_BY_LOAD]] to i64
// CHECK-NEXT: [[COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[TMP0]], i64 8
// CHECK-NEXT: [[COUNTED_BY_LOAD:%.*]] = load i32, ptr [[COUNTED_BY_GEP]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[COUNTED_BY_LOAD]] to i64
// CHECK-NEXT: [[TMP2:%.*]] = shl nsw i64 [[TMP1]], 1
// CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[DOT_COUNTED_BY_LOAD]], -1
// CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[COUNTED_BY_LOAD]], -1
// CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i64 [[TMP2]], i64 0
// CHECK-NEXT: tail call void @init(ptr noundef nonnull [[ARRAY]], i64 noundef [[TMP4]]) #[[ATTR2:[0-9]+]]
// CHECK-NEXT: ret void
Expand All @@ -48,15 +48,24 @@ void test1(struct bucket *foo) {
// CHECK-SAME: ptr noundef [[FOO:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT: entry:
// CHECK-NEXT: [[ARRAY:%.*]] = getelementptr inbounds nuw i8, ptr [[FOO]], i64 16
// CHECK-NEXT: [[DOT_COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[FOO]], i64 12
// CHECK-NEXT: [[DOT_COUNTED_BY_LOAD:%.*]] = load i32, ptr [[DOT_COUNTED_BY_GEP]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[DOT_COUNTED_BY_LOAD]] to i64
// CHECK-NEXT: [[COUNTED_BY_GEP:%.*]] = getelementptr inbounds nuw i8, ptr [[FOO]], i64 12
// CHECK-NEXT: [[COUNTED_BY_LOAD:%.*]] = load i32, ptr [[COUNTED_BY_GEP]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[COUNTED_BY_LOAD]] to i64
// CHECK-NEXT: [[TMP1:%.*]] = shl nsw i64 [[TMP0]], 1
// CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[DOT_COUNTED_BY_LOAD]], -1
// CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[COUNTED_BY_LOAD]], -1
// CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP2]], i64 [[TMP1]], i64 0
// CHECK-NEXT: tail call void @init(ptr noundef nonnull [[ARRAY]], i64 noundef [[TMP3]]) #[[ATTR2]]
// CHECK-NEXT: ret void
//
void test2(struct bucket2 *foo) {
init(foo->growable.array);
}
//.
// CHECK: [[TBAA2]] = !{[[META3:![0-9]+]], [[META7:![0-9]+]], i64 8}
// CHECK: [[META3]] = !{!"bucket", [[META4:![0-9]+]], i64 0, [[META7]], i64 8, [[META4]], i64 16}
// CHECK: [[META4]] = !{!"int", [[META5:![0-9]+]], i64 0}
// CHECK: [[META5]] = !{!"omnipotent char", [[META6:![0-9]+]], i64 0}
// CHECK: [[META6]] = !{!"Simple C/C++ TBAA"}
// CHECK: [[META7]] = !{!"p1 _ZTS8variable", [[META8:![0-9]+]], i64 0}
// CHECK: [[META8]] = !{!"any pointer", [[META5]], i64 0}
//.
Loading