Skip to content

Commit 1b2985c

Browse files
committed
merge main into amd-staging
Change-Id: I0c8bbecd0ed01deccb37075d5688ce8bf5b240e5
2 parents 1c000e3 + 3b20fb3 commit 1b2985c

File tree

171 files changed

+4765
-951
lines changed

Some content is hidden

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

171 files changed

+4765
-951
lines changed

.github/new-prs-labeler.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,26 @@ backend:PowerPC:
846846
- clang/lib/Driver/ToolChains/Arch/PPC.*
847847
- clang/test/CodeGen/PowerPC/**
848848

849+
backend:SystemZ:
850+
- llvm/include/llvm/BinaryFormat/ELFRelocs/SystemZ*
851+
- llvm/include/llvm/BinaryFormat/GOFF.h
852+
- llvm/include/llvm/IR/IntrinsicsSystemZ.td
853+
- llvm/lib/Target/SystemZ/**
854+
- llvm/test/Analysis/**/SystemZ/**
855+
- llvm/test/CodeGen/SystemZ/**
856+
- llvm/test/DebugInfo/SystemZ/**
857+
- llvm/test/ExecutionEngine/**/SystemZ/**
858+
- llvm/test/MC/Disassembler/SystemZ/**
859+
- llvm/test/MC/GOFF/**
860+
- llvm/test/MC/SystemZ/**
861+
- llvm/test/Transforms/**/SystemZ/**
862+
- clang/include/clang/Basic/BuiltinsSystemZ.*
863+
- clang/lib/Basic/Targets/SystemZ.*
864+
- clang/lib/CodeGen/Targets/SystemZ.cpp
865+
- clang/lib/Driver/ToolChains/ZOS*
866+
- clang/lib/Driver/ToolChains/Arch/SystemZ.*
867+
- clang/test/CodeGen/SystemZ/**
868+
849869
third-party:unittests:
850870
- third-party/unittests/**
851871

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ C++20 Feature Support
8383

8484
- Implemented the `__is_layout_compatible` intrinsic to support
8585
`P0466R5: Layout-compatibility and Pointer-interconvertibility Traits <https://wg21.link/P0466R5>`_.
86-
Note: `CWG2759: [[no_unique_address] and common initial sequence <https://cplusplus.github.io/CWG/issues/2759.html>`_
87-
is not yet implemented.
8886

8987
C++23 Feature Support
9088
^^^^^^^^^^^^^^^^^^^^^
@@ -113,6 +111,10 @@ Resolutions to C++ Defect Reports
113111
of two types.
114112
(`CWG1719: Layout compatibility and cv-qualification revisited <https://cplusplus.github.io/CWG/issues/1719.html>`_).
115113

114+
- ``[[no_unique_address]]`` is now respected when evaluating layout
115+
compatibility of two types.
116+
(`CWG2759: [[no_unique_address] and common initial sequence <https://cplusplus.github.io/CWG/issues/2759.html>`_).
117+
116118
C Language Changes
117119
------------------
118120

@@ -275,7 +277,7 @@ Bug Fixes to C++ Support
275277
local variable, which is supported as a C11 extension in C++. Previously, it
276278
was only accepted at namespace scope but not at local function scope.
277279
- Clang no longer tries to call consteval constructors at runtime when they appear in a member initializer.
278-
(`#782154 <https://github.com/llvm/llvm-project/issues/82154>`_`)
280+
(`#82154 <https://github.com/llvm/llvm-project/issues/82154>`_`)
279281
- Fix crash when using an immediate-escalated function at global scope.
280282
(`#82258 <https://github.com/llvm/llvm-project/issues/82258>`_)
281283
- Correctly immediate-escalate lambda conversion functions.

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
279279
def err_function_needs_feature : Error<
280280
"always_inline function %1 requires target feature '%2', but would "
281281
"be inlined into function %0 that is compiled without support for '%2'">;
282+
def err_function_always_inline_attribute_mismatch : Error<
283+
"always_inline function %1 and its caller %0 have mismatching %2 attributes">;
284+
def err_function_always_inline_new_za : Error<
285+
"always_inline function %0 has new za state">;
282286

283287
def warn_avx_calling_convention
284288
: Warning<"AVX vector %select{return|argument}0 of type %1 without '%2' "

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10362,6 +10362,8 @@ def err_x86_builtin_tile_arg_duplicate : Error<
1036210362

1036310363
def err_builtin_target_unsupported : Error<
1036410364
"builtin is not supported on this target">;
10365+
def err_builtin_aix_os_unsupported : Error<
10366+
"this builtin is available only on AIX 7.2 and later operating systems">;
1036510367
def err_builtin_longjmp_unsupported : Error<
1036610368
"__builtin_longjmp is not supported for the current target">;
1036710369
def err_builtin_setjmp_unsupported : Error<
@@ -12199,4 +12201,6 @@ def warn_acc_clause_unimplemented
1219912201
def err_acc_construct_appertainment
1220012202
: Error<"OpenACC construct '%0' cannot be used here; it can only "
1220112203
"be used in a statement context">;
12204+
def err_acc_branch_in_out
12205+
: Error<"invalid branch %select{out of|into}0 OpenACC region">;
1220212206
} // end of sema component.

clang/include/clang/Driver/ToolChain.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ class ToolChain {
121121
RM_Disabled,
122122
};
123123

124+
enum ExceptionsMode {
125+
EM_Enabled,
126+
EM_Disabled,
127+
};
128+
124129
struct BitCodeLibraryInfo {
125130
std::string Path;
126131
bool ShouldInternalize;
@@ -142,6 +147,8 @@ class ToolChain {
142147

143148
const RTTIMode CachedRTTIMode;
144149

150+
const ExceptionsMode CachedExceptionsMode;
151+
145152
/// The list of toolchain specific path prefixes to search for libraries.
146153
path_list LibraryPaths;
147154

@@ -327,6 +334,9 @@ class ToolChain {
327334
// Returns the RTTIMode for the toolchain with the current arguments.
328335
RTTIMode getRTTIMode() const { return CachedRTTIMode; }
329336

337+
// Returns the ExceptionsMode for the toolchain with the current arguments.
338+
ExceptionsMode getExceptionsMode() const { return CachedExceptionsMode; }
339+
330340
/// Return any implicit target and/or mode flag for an invocation of
331341
/// the compiler driver as `ProgName`.
332342
///

clang/include/clang/Sema/Scope.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ class Scope {
150150
/// template scope in between), the outer scope does not increase the
151151
/// depth of recursion.
152152
LambdaScope = 0x8000000,
153+
/// This is the scope of an OpenACC Compute Construct, which restricts
154+
/// jumping into/out of it.
155+
OpenACCComputeConstructScope = 0x10000000,
153156
};
154157

155158
private:
@@ -469,6 +472,14 @@ class Scope {
469472
return false;
470473
}
471474

475+
/// Return true if this scope is a loop.
476+
bool isLoopScope() const {
477+
// 'switch' is the only loop that is not a 'break' scope as well, so we can
478+
// just check BreakScope and not SwitchScope.
479+
return (getFlags() & Scope::BreakScope) &&
480+
!(getFlags() & Scope::SwitchScope);
481+
}
482+
472483
/// Determines whether this scope is the OpenMP directive scope
473484
bool isOpenMPDirectiveScope() const {
474485
return (getFlags() & Scope::OpenMPDirectiveScope);
@@ -504,6 +515,12 @@ class Scope {
504515
return getFlags() & Scope::OpenMPOrderClauseScope;
505516
}
506517

518+
/// Determine whether this scope is the statement associated with an OpenACC
519+
/// Compute construct directive.
520+
bool isOpenACCComputeConstructScope() const {
521+
return getFlags() & Scope::OpenACCComputeConstructScope;
522+
}
523+
507524
/// Determine whether this scope is a while/do/for statement, which can have
508525
/// continue statements embedded into it.
509526
bool isContinueScope() const {

clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,16 @@ class SValBuilder {
110110
/// that value is returned. Otherwise, returns NULL.
111111
virtual const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal val) = 0;
112112

113-
/// Tries to get the minimal possible (integer) value of a given SVal. If the
114-
/// constraint manager cannot provide an useful answer, this returns NULL.
113+
/// Tries to get the minimal possible (integer) value of a given SVal. This
114+
/// always returns the value of a ConcreteInt, but may return NULL if the
115+
/// value is symbolic and the constraint manager cannot provide a useful
116+
/// answer.
115117
virtual const llvm::APSInt *getMinValue(ProgramStateRef state, SVal val) = 0;
116118

117-
/// Tries to get the maximal possible (integer) value of a given SVal. If the
118-
/// constraint manager cannot provide an useful answer, this returns NULL.
119+
/// Tries to get the maximal possible (integer) value of a given SVal. This
120+
/// always returns the value of a ConcreteInt, but may return NULL if the
121+
/// value is symbolic and the constraint manager cannot provide a useful
122+
/// answer.
119123
virtual const llvm::APSInt *getMaxValue(ProgramStateRef state, SVal val) = 0;
120124

121125
/// Simplify symbolic expressions within a given SVal. Return an SVal

clang/lib/Basic/Targets/PPC.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,16 @@ bool PPCTargetInfo::validateCpuSupports(StringRef FeatureStr) const {
904904
}
905905

906906
bool PPCTargetInfo::validateCpuIs(StringRef CPUName) const {
907+
llvm::Triple Triple = getTriple();
908+
if (Triple.isOSAIX()) {
909+
#define PPC_AIX_CPU(NAME, SUPPORT, INDEX, OP, VALUE) .Case(NAME, true)
910+
return llvm::StringSwitch<bool>(CPUName)
911+
#include "llvm/TargetParser/PPCTargetParser.def"
912+
.Default(false);
913+
}
914+
915+
assert(Triple.isOSLinux() &&
916+
"__builtin_cpu_is() is only supported for AIX and Linux.");
907917
#define PPC_LNX_CPU(NAME, NUM) .Case(NAME, true)
908918
return llvm::StringSwitch<bool>(CPUName)
909919
#include "llvm/TargetParser/PPCTargetParser.def"

clang/lib/Basic/Targets/PPC.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,16 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo {
362362

363363
// We support __builtin_cpu_supports/__builtin_cpu_is on targets that
364364
// have Glibc since it is Glibc that provides the HWCAP[2] in the auxv.
365+
static constexpr int MINIMUM_AIX_OS_MAJOR = 7;
366+
static constexpr int MINIMUM_AIX_OS_MINOR = 2;
365367
bool supportsCpuSupports() const override { return getTriple().isOSGlibc(); }
366-
bool supportsCpuIs() const override { return getTriple().isOSGlibc(); }
368+
bool supportsCpuIs() const override {
369+
llvm::Triple Triple = getTriple();
370+
// AIX 7.2 is the minimum requirement to support __builtin_cpu_is().
371+
return Triple.isOSGlibc() ||
372+
(Triple.isOSAIX() &&
373+
!Triple.isOSVersionLT(MINIMUM_AIX_OS_MAJOR, MINIMUM_AIX_OS_MINOR));
374+
}
367375
bool validateCpuSupports(StringRef Feature) const override;
368376
bool validateCpuIs(StringRef Name) const override;
369377
};

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16546,12 +16546,59 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
1654616546

1654716547
Intrinsic::ID ID = Intrinsic::not_intrinsic;
1654816548

16549+
#include "llvm/TargetParser/PPCTargetParser.def"
16550+
auto GenAIXPPCBuiltinCpuExpr = [&](unsigned SupportMethod, unsigned FieldIdx,
16551+
unsigned CompOp,
16552+
unsigned OpValue) -> Value * {
16553+
if (SupportMethod == AIX_BUILTIN_PPC_FALSE)
16554+
return llvm::ConstantInt::getFalse(ConvertType(E->getType()));
16555+
16556+
if (SupportMethod == AIX_BUILTIN_PPC_TRUE)
16557+
return llvm::ConstantInt::getTrue(ConvertType(E->getType()));
16558+
16559+
assert(SupportMethod <= USE_SYS_CONF && "Invalid value for SupportMethod.");
16560+
assert((CompOp == COMP_EQ) && "Only equal comparisons are supported.");
16561+
16562+
llvm::Type *STy = llvm::StructType::get(PPC_SYSTEMCONFIG_TYPE);
16563+
llvm::Constant *SysConf =
16564+
CGM.CreateRuntimeVariable(STy, "_system_configuration");
16565+
16566+
// Grab the appropriate field from _system_configuration.
16567+
llvm::Value *Idxs[] = {ConstantInt::get(Int32Ty, 0),
16568+
ConstantInt::get(Int32Ty, FieldIdx)};
16569+
16570+
llvm::Value *FieldValue = Builder.CreateGEP(STy, SysConf, Idxs);
16571+
FieldValue = Builder.CreateAlignedLoad(Int32Ty, FieldValue,
16572+
CharUnits::fromQuantity(4));
16573+
assert(FieldValue->getType()->isIntegerTy(32) &&
16574+
"Only 32-bit integers are supported in GenAIXPPCBuiltinCpuExpr().");
16575+
return Builder.CreateICmp(ICmpInst::ICMP_EQ, FieldValue,
16576+
ConstantInt::get(Int32Ty, OpValue));
16577+
};
16578+
1654916579
switch (BuiltinID) {
1655016580
default: return nullptr;
1655116581

1655216582
case Builtin::BI__builtin_cpu_is: {
1655316583
const Expr *CPUExpr = E->getArg(0)->IgnoreParenCasts();
1655416584
StringRef CPUStr = cast<clang::StringLiteral>(CPUExpr)->getString();
16585+
llvm::Triple Triple = getTarget().getTriple();
16586+
16587+
if (Triple.isOSAIX()) {
16588+
unsigned IsCpuSupport, FieldIdx, CompareOp, CpuIdValue;
16589+
typedef std::tuple<unsigned, unsigned, unsigned, unsigned> CPUType;
16590+
std::tie(IsCpuSupport, FieldIdx, CompareOp, CpuIdValue) =
16591+
static_cast<CPUType>(StringSwitch<CPUType>(CPUStr)
16592+
#define PPC_AIX_CPU(NAME, SUPPORT_MAGIC, INDEX, COMPARE_OP, VALUE) \
16593+
.Case(NAME, {SUPPORT_MAGIC, INDEX, COMPARE_OP, VALUE})
16594+
#include "llvm/TargetParser/PPCTargetParser.def"
16595+
);
16596+
return GenAIXPPCBuiltinCpuExpr(IsCpuSupport, FieldIdx, CompareOp,
16597+
CpuIdValue);
16598+
}
16599+
16600+
assert(Triple.isOSLinux() &&
16601+
"__builtin_cpu_is() is only supported for AIX and Linux.");
1655516602
unsigned NumCPUID = StringSwitch<unsigned>(CPUStr)
1655616603
#define PPC_LNX_CPU(Name, NumericID) .Case(Name, NumericID)
1655716604
#include "llvm/TargetParser/PPCTargetParser.def"

0 commit comments

Comments
 (0)