Skip to content

Commit 99b32f0

Browse files
author
z1.cciauto
committed
merge main into amd-staging
2 parents 015420f + 760a786 commit 99b32f0

File tree

161 files changed

+6666
-5852
lines changed

Some content is hidden

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

161 files changed

+6666
-5852
lines changed

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
190190
set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL "")
191191
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
192192

193+
# Enable FatLTO for Linux and baremetal runtimes
194+
set(RUNTIMES_${target}_LLVM_ENABLE_LTO ON CACHE BOOL "")
195+
set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO ON CACHE BOOL "")
196+
193197
# Use .build-id link.
194198
list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
195199
endif()
@@ -272,6 +276,10 @@ if(FUCHSIA_SDK)
272276
set(RUNTIMES_${target}+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
273277
set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
274278

279+
# Enable FatLTO for Fuchsia runtimes
280+
set(RUNTIMES_${target}_LLVM_ENABLE_LTO ON CACHE BOOL "")
281+
set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO ON CACHE BOOL "")
282+
275283
# Use .build-id link.
276284
list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
277285
endforeach()
@@ -369,6 +377,10 @@ foreach(target armv6m-none-eabi;armv7m-none-eabi;armv7em-none-eabi;armv8m.main-n
369377
set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
370378
set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
371379
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "")
380+
381+
# Enable FatLTO for baremetal runtimes
382+
set(RUNTIMES_${target}_LLVM_ENABLE_LTO ON CACHE BOOL "")
383+
set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO ON CACHE BOOL "")
372384
endforeach()
373385

374386
foreach(target riscv32-unknown-elf)
@@ -420,6 +432,10 @@ foreach(target riscv32-unknown-elf)
420432
set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
421433
set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
422434
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "")
435+
436+
# Enable FatLTO for baremetal runtimes
437+
set(RUNTIMES_${target}_LLVM_ENABLE_LTO ON CACHE BOOL "")
438+
set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO ON CACHE BOOL "")
423439
endforeach()
424440

425441
set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")

clang/docs/LanguageExtensions.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,7 @@ available in all language modes.
514514
__nullptr
515515
---------
516516

517-
``__nullptr`` is an alternate spelling for ``nullptr``, but is also available in
518-
C++ modes prior to C++11. Note that it's currently not availbale in C despite
519-
C23 having support for ``nullptr``.
517+
``__nullptr`` is an alternate spelling for ``nullptr``. It is available in all C and C++ language modes.
520518

521519
__signed, __signed__
522520
--------------------

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ C Language Changes
396396

397397
- Extend clang's ``<limits.h>`` to define ``LONG_LONG_*`` macros for Android's bionic.
398398
- Macro ``__STDC_NO_THREADS__`` is no longer necessary for MSVC 2022 1939 and later.
399+
- Exposed the the ``__nullptr`` keyword as an alias for ``nullptr`` in all C language modes.
399400

400401
C2y Feature Support
401402
^^^^^^^^^^^^^^^^^^^
@@ -1035,6 +1036,7 @@ Bug Fixes to C++ Support
10351036
- Fixed assertions or false compiler diagnostics in the case of C++ modules for
10361037
lambda functions or inline friend functions defined inside templates (#GH122493).
10371038
- Clang now rejects declaring an alias template with the same name as its template parameter. (#GH123423)
1039+
- Fixed the rejection of valid code when referencing an enumerator of an unscoped enum member with a prior declaration. (#GH124405)
10381040
- Fixed immediate escalation of non-dependent expressions. (#GH123405)
10391041
- Fix type of expression when calling a template which returns an ``__array_rank`` querying a type depending on a
10401042
template parameter. Now, such expression can be used with ``static_assert`` and ``constexpr``. (#GH123498)

clang/include/clang/AST/ASTLambda.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "clang/AST/DeclCXX.h"
1919
#include "clang/AST/DeclTemplate.h"
20+
#include "llvm/Support/Casting.h"
2021

2122
namespace clang {
2223
inline StringRef getLambdaStaticInvokerName() {
@@ -35,6 +36,12 @@ inline bool isLambdaCallOperator(const DeclContext *DC) {
3536
return isLambdaCallOperator(cast<CXXMethodDecl>(DC));
3637
}
3738

39+
inline bool isLambdaMethod(const DeclContext *DC) {
40+
if (const auto *MD = dyn_cast_if_present<CXXMethodDecl>(DC))
41+
return MD->getParent()->isLambda();
42+
return false;
43+
}
44+
3845
inline bool isLambdaCallWithExplicitObjectParameter(const DeclContext *DC) {
3946
return isLambdaCallOperator(DC) &&
4047
cast<CXXMethodDecl>(DC)->isExplicitObjectMemberFunction();

clang/include/clang/AST/DeclCXX.h

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,24 +1967,42 @@ class ExplicitSpecifier {
19671967
class CXXDeductionGuideDecl : public FunctionDecl {
19681968
void anchor() override;
19691969

1970+
public:
1971+
// Represents the relationship between this deduction guide and the
1972+
// deduction guide that it was generated from (or lack thereof).
1973+
// See the SourceDeductionGuide member for more details.
1974+
enum class SourceDeductionGuideKind : uint8_t {
1975+
None,
1976+
Alias,
1977+
};
1978+
19701979
private:
19711980
CXXDeductionGuideDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
19721981
ExplicitSpecifier ES,
19731982
const DeclarationNameInfo &NameInfo, QualType T,
19741983
TypeSourceInfo *TInfo, SourceLocation EndLocation,
19751984
CXXConstructorDecl *Ctor, DeductionCandidate Kind,
1976-
Expr *TrailingRequiresClause)
1985+
Expr *TrailingRequiresClause,
1986+
const CXXDeductionGuideDecl *GeneratedFrom,
1987+
SourceDeductionGuideKind SourceKind)
19771988
: FunctionDecl(CXXDeductionGuide, C, DC, StartLoc, NameInfo, T, TInfo,
19781989
SC_None, false, false, ConstexprSpecKind::Unspecified,
19791990
TrailingRequiresClause),
1980-
Ctor(Ctor), ExplicitSpec(ES) {
1991+
Ctor(Ctor), ExplicitSpec(ES),
1992+
SourceDeductionGuide(GeneratedFrom, SourceKind) {
19811993
if (EndLocation.isValid())
19821994
setRangeEnd(EndLocation);
19831995
setDeductionCandidateKind(Kind);
19841996
}
19851997

19861998
CXXConstructorDecl *Ctor;
19871999
ExplicitSpecifier ExplicitSpec;
2000+
// The deduction guide, if any, that this deduction guide was generated from,
2001+
// in the case of alias template deduction. The SourceDeductionGuideKind
2002+
// member indicates which of these sources applies, or is None otherwise.
2003+
llvm::PointerIntPair<const CXXDeductionGuideDecl *, 2,
2004+
SourceDeductionGuideKind>
2005+
SourceDeductionGuide;
19882006
void setExplicitSpecifier(ExplicitSpecifier ES) { ExplicitSpec = ES; }
19892007

19902008
public:
@@ -1997,7 +2015,9 @@ class CXXDeductionGuideDecl : public FunctionDecl {
19972015
TypeSourceInfo *TInfo, SourceLocation EndLocation,
19982016
CXXConstructorDecl *Ctor = nullptr,
19992017
DeductionCandidate Kind = DeductionCandidate::Normal,
2000-
Expr *TrailingRequiresClause = nullptr);
2018+
Expr *TrailingRequiresClause = nullptr,
2019+
const CXXDeductionGuideDecl *SourceDG = nullptr,
2020+
SourceDeductionGuideKind SK = SourceDeductionGuideKind::None);
20012021

20022022
static CXXDeductionGuideDecl *CreateDeserialized(ASTContext &C,
20032023
GlobalDeclID ID);
@@ -2017,6 +2037,25 @@ class CXXDeductionGuideDecl : public FunctionDecl {
20172037
/// this is an implicit deduction guide.
20182038
CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; }
20192039

2040+
/// Get the deduction guide from which this deduction guide was generated,
2041+
/// if it was generated as part of alias template deduction or from an
2042+
/// inherited constructor.
2043+
const CXXDeductionGuideDecl *getSourceDeductionGuide() const {
2044+
return SourceDeductionGuide.getPointer();
2045+
}
2046+
2047+
void setSourceDeductionGuide(CXXDeductionGuideDecl *DG) {
2048+
SourceDeductionGuide.setPointer(DG);
2049+
}
2050+
2051+
SourceDeductionGuideKind getSourceDeductionGuideKind() const {
2052+
return SourceDeductionGuide.getInt();
2053+
}
2054+
2055+
void setSourceDeductionGuideKind(SourceDeductionGuideKind SK) {
2056+
SourceDeductionGuide.setInt(SK);
2057+
}
2058+
20202059
void setDeductionCandidateKind(DeductionCandidate K) {
20212060
FunctionDeclBits.DeductionCandidateKind = static_cast<unsigned char>(K);
20222061
}

clang/include/clang/Basic/TokenKinds.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ ALIAS("__decltype" , decltype , KEYCXX)
707707
ALIAS("__imag__" , __imag , KEYALL)
708708
ALIAS("__inline" , inline , KEYALL)
709709
ALIAS("__inline__" , inline , KEYALL)
710-
ALIAS("__nullptr" , nullptr , KEYCXX)
710+
ALIAS("__nullptr" , nullptr , KEYALL)
711711
ALIAS("__real__" , __real , KEYALL)
712712
ALIAS("__restrict" , restrict , KEYALL)
713713
ALIAS("__restrict__" , restrict , KEYALL)

clang/include/clang/Basic/arm_neon.td

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,6 +2141,50 @@ let ArchGuard = "defined(__aarch64__)", TargetGuard = "fp8,neon" in {
21412141
def VCVTN_F8_F16 : VInst<"vcvt_mf8_f16_fpm", ".(>F)(>F)V", "mQm">;
21422142
}
21432143

2144+
let ArchGuard = "defined(__aarch64__)", TargetGuard = "fp8dot2,neon" in {
2145+
def VDOT_F16_MF8 : VInst<"vdot_f16_mf8_fpm", "(>F)(>F)..V", "mQm">;
2146+
2147+
def VDOT_LANE_F16_MF8 : VInst<"vdot_lane_f16_mf8_fpm", "(>F)(>F)..IV", "m", [ImmCheck<3, ImmCheck0_3, 0>]>;
2148+
def VDOT_LANEQ_F16_MF8 : VInst<"vdot_laneq_f16_mf8_fpm", "(>F)(>F).QIV", "m", [ImmCheck<3, ImmCheck0_7, 0>]>;
2149+
2150+
def VDOTQ_LANE_F16_MF8 : VInst<"vdot_lane_f16_mf8_fpm", "(>F)(>F).qIV", "Qm", [ImmCheck<3, ImmCheck0_3, 0>]>;
2151+
def VDOTQ_LANEQ_F16_MF8 : VInst<"vdot_laneq_f16_mf8_fpm", "(>F)(>F)..IV", "Qm", [ImmCheck<3, ImmCheck0_7, 0>]>;
2152+
}
2153+
2154+
let ArchGuard = "defined(__aarch64__)", TargetGuard = "fp8dot4,neon" in {
2155+
def VDOT_F32_MF8 : VInst<"vdot_f32_mf8_fpm", "(>>F)(>>F)..V", "mQm">;
2156+
2157+
def VDOT_LANE_F32_MF8 : VInst<"vdot_lane_f32_mf8_fpm", "(>>F)(>>F)..IV", "m", [ImmCheck<3, ImmCheck0_1, 0>]>;
2158+
def VDOT_LANEQ_F32_MF8 : VInst<"vdot_laneq_f32_mf8_fpm", "(>>F)(>>F).QIV", "m", [ImmCheck<3, ImmCheck0_3, 0>]>;
2159+
2160+
def VDOTQ_LANE_F32_MF8 : VInst<"vdot_lane_f32_mf8_fpm", "(>>F)(>>F).qIV", "Qm", [ImmCheck<3, ImmCheck0_1, 0>]>;
2161+
def VDOTQ_LANEQ_F32_MF8 : VInst<"vdot_laneq_f32_mf8_fpm", "(>>F)(>>F)..IV", "Qm", [ImmCheck<3, ImmCheck0_3, 0>]>;
2162+
}
2163+
2164+
let ArchGuard = "defined(__aarch64__)", TargetGuard = "fp8fma,neon" in {
2165+
def VMLALB_F16_F8 : VInst<"vmlalb_f16_mf8_fpm", "(>F)(>F)..V", "Qm">;
2166+
def VMLALT_F16_F8 : VInst<"vmlalt_f16_mf8_fpm", "(>F)(>F)..V", "Qm">;
2167+
2168+
def VMLALLBB_F32_F8 : VInst<"vmlallbb_f32_mf8_fpm", "(>>F)(>>F)..V", "Qm">;
2169+
def VMLALLBT_F32_F8 : VInst<"vmlallbt_f32_mf8_fpm", "(>>F)(>>F)..V", "Qm">;
2170+
def VMLALLTB_F32_F8 : VInst<"vmlalltb_f32_mf8_fpm", "(>>F)(>>F)..V", "Qm">;
2171+
def VMLALLTT_F32_F8 : VInst<"vmlalltt_f32_mf8_fpm", "(>>F)(>>F)..V", "Qm">;
2172+
2173+
def VMLALB_F16_F8_LANE : VInst<"vmlalb_lane_f16_mf8_fpm", "(>F)(>F).qIV", "Qm", [ImmCheck<3, ImmCheck0_7, 0>]>;
2174+
def VMLALB_F16_F8_LANEQ : VInst<"vmlalb_laneq_f16_mf8_fpm", "(>F)(>F)..IV", "Qm", [ImmCheck<3, ImmCheck0_15, 0>]>;
2175+
def VMLALT_F16_F8_LANE : VInst<"vmlalt_lane_f16_mf8_fpm", "(>F)(>F).qIV", "Qm", [ImmCheck<3, ImmCheck0_7, 0>]>;
2176+
def VMLALT_F16_F8_LANEQ : VInst<"vmlalt_laneq_f16_mf8_fpm", "(>F)(>F)..IV", "Qm", [ImmCheck<3, ImmCheck0_15, 0>]>;
2177+
2178+
def VMLALLBB_F32_F8_LANE : VInst<"vmlallbb_lane_f32_mf8_fpm", "(>>F)(>>F).qIV", "Qm", [ImmCheck<3, ImmCheck0_7, 0>]>;
2179+
def VMLALLBB_F32_F8_LANEQ : VInst<"vmlallbb_laneq_f32_mf8_fpm", "(>>F)(>>F)..IV", "Qm", [ImmCheck<3, ImmCheck0_15, 0>]>;
2180+
def VMLALLBT_F32_F8_LANE : VInst<"vmlallbt_lane_f32_mf8_fpm", "(>>F)(>>F).qIV", "Qm", [ImmCheck<3, ImmCheck0_7, 0>]>;
2181+
def VMLALLBT_F32_F8_LANEQ : VInst<"vmlallbt_laneq_f32_mf8_fpm", "(>>F)(>>F)..IV", "Qm", [ImmCheck<3, ImmCheck0_15, 0>]>;
2182+
def VMLALLTB_F32_F8_LANE : VInst<"vmlalltb_lane_f32_mf8_fpm", "(>>F)(>>F).qIV", "Qm", [ImmCheck<3, ImmCheck0_7, 0>]>;
2183+
def VMLALLTB_F32_F8_LANEQ : VInst<"vmlalltb_laneq_f32_mf8_fpm", "(>>F)(>>F)..IV", "Qm", [ImmCheck<3, ImmCheck0_15, 0>]>;
2184+
def VMLALLTT_F32_F8_LANE : VInst<"vmlalltt_lane_f32_mf8_fpm", "(>>F)(>>F).qIV", "Qm", [ImmCheck<3, ImmCheck0_7, 0>]>;
2185+
def VMLALLTT_F32_F8_LANEQ : VInst<"vmlalltt_laneq_f32_mf8_fpm", "(>>F)(>>F)..IV", "Qm", [ImmCheck<3, ImmCheck0_15, 0>]>;
2186+
}
2187+
21442188
let ArchGuard = "defined(__aarch64__)", TargetGuard = "neon,faminmax" in {
21452189
def FAMIN : WInst<"vamin", "...", "fhQdQfQh">;
21462190
def FAMAX : WInst<"vamax", "...", "fhQdQfQh">;

clang/include/clang/Basic/arm_neon_incl.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class Inst <string n, string p, string t, Operation o, list<ImmCheck> ch = []>{
302302
class SInst<string n, string p, string t, list<ImmCheck> ch = []> : Inst<n, p, t, OP_NONE, ch> {}
303303
class IInst<string n, string p, string t, list<ImmCheck> ch = []> : Inst<n, p, t, OP_NONE, ch> {}
304304
class WInst<string n, string p, string t, list<ImmCheck> ch = []> : Inst<n, p, t, OP_NONE, ch> {}
305-
class VInst<string n, string p, string t> : Inst<n, p, t, OP_NONE> {}
305+
class VInst<string n, string p, string t, list<ImmCheck> ch = []> : Inst<n, p, t, OP_NONE, ch> {}
306306

307307
// The following instruction classes are implemented via operators
308308
// instead of builtins. As such these declarations are only used for

clang/include/clang/Sema/Sema.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "clang/APINotes/APINotesManager.h"
1818
#include "clang/AST/ASTFwd.h"
19+
#include "clang/AST/ASTLambda.h"
1920
#include "clang/AST/Attr.h"
2021
#include "clang/AST/AttrIterator.h"
2122
#include "clang/AST/CharUnits.h"
@@ -13108,14 +13109,16 @@ class Sema final : public SemaBase {
1310813109
? ExpressionEvaluationContext::ImmediateFunctionContext
1310913110
: ExpressionEvaluationContext::PotentiallyEvaluated);
1311013111
if (FD) {
13112+
auto &Current = S.currentEvaluationContext();
13113+
const auto &Parent = S.parentEvaluationContext();
13114+
1311113115
FD->setWillHaveBody(true);
13112-
S.ExprEvalContexts.back().InImmediateFunctionContext =
13116+
Current.InImmediateFunctionContext =
1311313117
FD->isImmediateFunction() ||
13114-
S.ExprEvalContexts[S.ExprEvalContexts.size() - 2]
13115-
.isConstantEvaluated() ||
13116-
S.ExprEvalContexts[S.ExprEvalContexts.size() - 2]
13117-
.isImmediateFunctionContext();
13118-
S.ExprEvalContexts.back().InImmediateEscalatingFunctionContext =
13118+
(isLambdaMethod(FD) && (Parent.isConstantEvaluated() ||
13119+
Parent.isImmediateFunctionContext()));
13120+
13121+
Current.InImmediateEscalatingFunctionContext =
1311913122
S.getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
1312013123
} else
1312113124
assert(isa<ObjCMethodDecl>(DC));

clang/lib/AST/ASTImporter.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "clang/AST/ASTContext.h"
1616
#include "clang/AST/ASTDiagnostic.h"
1717
#include "clang/AST/ASTImporterSharedState.h"
18+
#include "clang/AST/ASTLambda.h"
1819
#include "clang/AST/ASTStructuralEquivalence.h"
1920
#include "clang/AST/Attr.h"
2021
#include "clang/AST/Decl.h"
@@ -3729,10 +3730,7 @@ bool ASTNodeImporter::hasReturnTypeDeclaredInside(FunctionDecl *D) {
37293730
if (Importer.FromContext.getLangOpts().CPlusPlus14) // C++14 or later
37303731
return false;
37313732

3732-
if (const auto *MD = dyn_cast<CXXMethodDecl>(D))
3733-
return cast<CXXRecordDecl>(MD->getDeclContext())->isLambda();
3734-
3735-
return false;
3733+
return isLambdaMethod(D);
37363734
};
37373735

37383736
QualType RetT = FromFPT->getReturnType();
@@ -3999,14 +3997,16 @@ ExpectedDecl ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {
39993997
importExplicitSpecifier(Err, Guide->getExplicitSpecifier());
40003998
CXXConstructorDecl *Ctor =
40013999
importChecked(Err, Guide->getCorrespondingConstructor());
4000+
const CXXDeductionGuideDecl *SourceDG =
4001+
importChecked(Err, Guide->getSourceDeductionGuide());
40024002
if (Err)
40034003
return std::move(Err);
40044004
if (GetImportedOrCreateDecl<CXXDeductionGuideDecl>(
40054005
ToFunction, D, Importer.getToContext(), DC, ToInnerLocStart, ESpec,
4006-
NameInfo, T, TInfo, ToEndLoc, Ctor))
4006+
NameInfo, T, TInfo, ToEndLoc, Ctor,
4007+
Guide->getDeductionCandidateKind(), TrailingRequiresClause,
4008+
SourceDG, Guide->getSourceDeductionGuideKind()))
40074009
return ToFunction;
4008-
cast<CXXDeductionGuideDecl>(ToFunction)
4009-
->setDeductionCandidateKind(Guide->getDeductionCandidateKind());
40104010
} else {
40114011
if (GetImportedOrCreateDecl(
40124012
ToFunction, D, Importer.getToContext(), DC, ToInnerLocStart,

0 commit comments

Comments
 (0)