Skip to content

Commit d563f64

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#3610)
2 parents ba4bd9e + 79b1b13 commit d563f64

File tree

138 files changed

+900
-1241
lines changed

Some content is hidden

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

138 files changed

+900
-1241
lines changed

.ci/utils.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function at-exit {
2424
retcode=$?
2525

2626
mkdir -p artifacts
27+
sccache --show-stats
2728
sccache --show-stats >> artifacts/sccache_stats.txt
2829
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
2930
cp "${MONOREPO_ROOT}"/*.log artifacts/ || :

.github/workflows/spirv-tests.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ permissions:
44
contents: read
55

66
on:
7-
workflow_dispatch:
87
pull_request:
98
paths:
109
- 'llvm/lib/Target/SPIRV/**'
@@ -21,9 +20,27 @@ jobs:
2120
check_spirv:
2221
if: github.repository_owner == 'llvm'
2322
name: Test SPIR-V
24-
uses: ./.github/workflows/llvm-project-tests.yml
25-
with:
26-
build_target: check-llvm-codegen-spirv
27-
projects:
28-
extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="SPIRV" -DLLVM_INCLUDE_SPIRV_TOOLS_TESTS=ON'
29-
os_list: '["ubuntu-24.04"]'
23+
runs-on: ubuntu-24.04
24+
container:
25+
image: ghcr.io/llvm/ci-ubuntu-24.04:latest
26+
steps:
27+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
- name: Setup ccache
29+
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
30+
with:
31+
max-size: 2G
32+
key: spirv-ubuntu-24.04
33+
variant: sccache
34+
- name: Build and Test
35+
run: |
36+
mkdir build
37+
cmake -GNinja \
38+
-S llvm \
39+
-B build \
40+
-DCMAKE_BUILD_TYPE=Release \
41+
-DLLVM_ENABLE_ASSERTIONS=ON \
42+
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
43+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
44+
-DLLVM_TARGETS_TO_BUILD="SPIRV" \
45+
-DLLVM_INCLUDE_SPIRV_TOOLS_TESTS=ON
46+
ninja -C build check-llvm-codegen-spirv

clang/lib/Sema/SemaDecl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20297,9 +20297,10 @@ Decl *Sema::ActOnEnumConstant(Scope *S, Decl *theEnumDecl, Decl *lastEnumConst,
2029720297
// different from T:
2029820298
// - every enumerator of every member of class T that is an unscoped
2029920299
// enumerated type
20300-
if (getLangOpts().CPlusPlus && !TheEnumDecl->isScoped())
20301-
DiagnoseClassNameShadow(TheEnumDecl->getDeclContext(),
20302-
DeclarationNameInfo(Id, IdLoc));
20300+
if (getLangOpts().CPlusPlus && !TheEnumDecl->isScoped() &&
20301+
DiagnoseClassNameShadow(TheEnumDecl->getDeclContext(),
20302+
DeclarationNameInfo(Id, IdLoc)))
20303+
return nullptr;
2030320304

2030420305
EnumConstantDecl *New =
2030520306
CheckEnumConstant(TheEnumDecl, LastEnumConst, IdLoc, Id, Val);

clang/test/CXX/class/class.mem/p13.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,12 @@ template<typename B> struct CtorDtorName : B {
114114
CtorDtorName();
115115
~CtorDtorName(); // expected-error {{identifier 'CtorDtorName' after '~' in destructor name does not name a type}}
116116
};
117+
118+
struct S { // expected-note {{'S' declared here}}
119+
enum E {
120+
R = 11,
121+
S = 12 // expected-error {{member 'S' has the same name as its class}}
122+
};
123+
static_assert(E::R == 11, "E::R is not 11");
124+
static_assert(E::S == 12, "E::S is not 12"); // expected-error {{no member named 'S' in 'S::E'}}
125+
};

libc/benchmarks/gpu/timing/amdgpu/timing.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ throughput_baseline(const cpp::array<T, N> &inputs) {
117117
asm("" ::"s"(start));
118118

119119
T result{};
120+
121+
#pragma clang loop unroll(disable)
120122
for (auto input : inputs) {
121123
asm("" ::"v"(input));
122124
result = input;
@@ -146,6 +148,8 @@ static LIBC_INLINE uint64_t throughput(F f, const cpp::array<T, N> &inputs) {
146148
asm("" ::"s"(start));
147149

148150
T result{};
151+
152+
#pragma clang loop unroll(disable)
149153
for (auto input : inputs) {
150154
asm("" ::"v"(input));
151155
result = f(input);
@@ -174,6 +178,8 @@ static LIBC_INLINE uint64_t throughput_baseline(
174178
asm("" ::"s"(start));
175179

176180
T result{};
181+
182+
#pragma clang loop unroll(disable)
177183
for (size_t i = 0; i < N; i++) {
178184
T x = inputs1[i];
179185
T y = inputs2[i];
@@ -206,6 +212,8 @@ static LIBC_INLINE uint64_t throughput(F f, const cpp::array<T, N> &inputs1,
206212
asm("" ::"s"(start));
207213

208214
T result{};
215+
216+
#pragma clang loop unroll(disable)
209217
for (size_t i = 0; i < N; i++) {
210218
T x = inputs1[i];
211219
T y = inputs2[i];

libc/benchmarks/gpu/timing/nvptx/timing.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ throughput_baseline(const cpp::array<T, N> &inputs) {
106106
asm("" ::"llr"(start));
107107

108108
T result{};
109+
110+
#pragma clang loop unroll(disable)
109111
for (auto input : inputs) {
110112
asm("" ::"r"(input));
111113
result = input;
@@ -135,6 +137,8 @@ static LIBC_INLINE uint64_t throughput(F f, const cpp::array<T, N> &inputs) {
135137
asm("" ::"llr"(start));
136138

137139
T result{};
140+
141+
#pragma clang loop unroll(disable)
138142
for (auto input : inputs) {
139143
asm("" ::"r"(input));
140144
result = f(input);
@@ -163,6 +167,8 @@ static LIBC_INLINE uint64_t throughput_baseline(
163167
asm("" ::"llr"(start));
164168

165169
T result{};
170+
171+
#pragma clang loop unroll(disable)
166172
for (size_t i = 0; i < N; i++) {
167173
T x = inputs1[i];
168174
T y = inputs2[i];
@@ -195,6 +201,8 @@ static LIBC_INLINE uint64_t throughput(F f, const cpp::array<T, N> &inputs1,
195201
asm("" ::"llr"(start));
196202

197203
T result{};
204+
205+
#pragma clang loop unroll(disable)
198206
for (size_t i = 0; i < N; i++) {
199207
T x = inputs1[i];
200208
T y = inputs2[i];

libc/include/sched.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ functions:
2020
- type: const cpu_set_t *
2121
- name: getcpu
2222
standards:
23-
- POSIX
23+
- Linux
2424
return_type: int
2525
arguments:
2626
- type: unsigned int *

llvm/include/llvm/ADT/SmallPtrSet.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
435435
bool remove_if(UnaryPredicate P) {
436436
bool Removed = false;
437437
if (isSmall()) {
438-
const void **APtr = CurArray, **E = CurArray + NumEntries;
438+
auto Buckets = small_buckets();
439+
const void **APtr = Buckets.begin(), **E = Buckets.end();
439440
while (APtr != E) {
440441
PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(*APtr));
441442
if (P(Ptr)) {

llvm/include/llvm/MC/MCSymbol.h

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ class raw_ostream;
4242
class MCSymbol {
4343
protected:
4444
// A symbol can be regular, equated to an expression, or a common symbol.
45-
enum Contents : uint8_t {
46-
SymContentsUnset,
47-
SymContentsVariable,
48-
SymContentsCommon,
49-
SymContentsTargetCommon, // Index stores the section index
45+
enum Kind : uint8_t {
46+
Regular,
47+
Equated,
48+
Common,
5049
};
5150

5251
// Special sentinel value for the absolute pseudo fragment.
@@ -65,6 +64,10 @@ class MCSymbol {
6564
/// relative to, if any.
6665
mutable MCFragment *Fragment = nullptr;
6766

67+
/// The symbol kind. Use an unsigned bitfield to achieve better bitpacking
68+
/// with MSVC.
69+
unsigned kind : 2;
70+
6871
/// True if this symbol is named. A named symbol will have a pointer to the
6972
/// name allocated in the bytes immediately prior to the MCSymbol.
7073
unsigned HasName : 1;
@@ -95,10 +98,6 @@ class MCSymbol {
9598
/// Used to detect cyclic dependency like `a = a + 1` and `a = b; b = a`.
9699
unsigned IsResolving : 1;
97100

98-
/// This is actually a Contents enumerator, but is unsigned to avoid sign
99-
/// extension and achieve better bitpacking with MSVC.
100-
unsigned SymbolContents : 3;
101-
102101
/// The alignment of the symbol if it is 'common'.
103102
///
104103
/// Internally, this is stored as log2(align) + 1.
@@ -145,9 +144,9 @@ class MCSymbol {
145144
};
146145

147146
MCSymbol(const MCSymbolTableEntry *Name, bool isTemporary)
148-
: IsTemporary(isTemporary), IsRedefinable(false), IsRegistered(false),
149-
IsExternal(false), IsPrivateExtern(false), IsWeakExternal(false),
150-
IsUsedInReloc(false), IsResolving(0), SymbolContents(SymContentsUnset),
147+
: kind(Kind::Regular), IsTemporary(isTemporary), IsRedefinable(false),
148+
IsRegistered(false), IsExternal(false), IsPrivateExtern(false),
149+
IsWeakExternal(false), IsUsedInReloc(false), IsResolving(0),
151150
CommonAlignLog2(0), Flags(0) {
152151
Offset = 0;
153152
HasName = !!Name;
@@ -212,9 +211,9 @@ class MCSymbol {
212211
/// Prepare this symbol to be redefined.
213212
void redefineIfPossible() {
214213
if (IsRedefinable) {
215-
if (SymbolContents == SymContentsVariable) {
214+
if (kind == Kind::Equated) {
216215
Value = nullptr;
217-
SymbolContents = SymContentsUnset;
216+
kind = Kind::Regular;
218217
}
219218
setUndefined();
220219
IsRedefinable = false;
@@ -268,9 +267,7 @@ class MCSymbol {
268267
/// @{
269268

270269
/// isVariable - Check if this is a variable symbol.
271-
bool isVariable() const {
272-
return SymbolContents == SymContentsVariable;
273-
}
270+
bool isVariable() const { return kind == Equated; }
274271

275272
/// Get the expression of the variable symbol.
276273
const MCExpr *getVariableValue() const {
@@ -293,12 +290,12 @@ class MCSymbol {
293290
}
294291

295292
uint64_t getOffset() const {
296-
assert(SymbolContents == SymContentsUnset &&
293+
assert(kind == Kind::Regular &&
297294
"Cannot get offset for a common/variable symbol");
298295
return Offset;
299296
}
300297
void setOffset(uint64_t Value) {
301-
assert(SymbolContents == SymContentsUnset &&
298+
assert(kind == Kind::Regular &&
302299
"Cannot set offset for a common/variable symbol");
303300
Offset = Value;
304301
}
@@ -314,10 +311,10 @@ class MCSymbol {
314311
/// \param Size - The size of the symbol.
315312
/// \param Alignment - The alignment of the symbol.
316313
/// \param Target - Is the symbol a target-specific common-like symbol.
317-
void setCommon(uint64_t Size, Align Alignment, bool Target = false) {
314+
void setCommon(uint64_t Size, Align Alignment) {
318315
assert(getOffset() == 0);
319316
CommonSize = Size;
320-
SymbolContents = Target ? SymContentsTargetCommon : SymContentsCommon;
317+
kind = Kind::Common;
321318

322319
unsigned Log2Align = encode(Alignment);
323320
assert(Log2Align < (1U << NumCommonAlignmentBits) &&
@@ -335,29 +332,19 @@ class MCSymbol {
335332
///
336333
/// \param Size - The size of the symbol.
337334
/// \param Alignment - The alignment of the symbol.
338-
/// \param Target - Is the symbol a target-specific common-like symbol.
339335
/// \return True if symbol was already declared as a different type
340-
bool declareCommon(uint64_t Size, Align Alignment, bool Target = false) {
336+
bool declareCommon(uint64_t Size, Align Alignment) {
341337
assert(isCommon() || getOffset() == 0);
342338
if(isCommon()) {
343-
if (CommonSize != Size || getCommonAlignment() != Alignment ||
344-
isTargetCommon() != Target)
339+
if (CommonSize != Size || getCommonAlignment() != Alignment)
345340
return true;
346341
} else
347-
setCommon(Size, Alignment, Target);
342+
setCommon(Size, Alignment);
348343
return false;
349344
}
350345

351346
/// Is this a 'common' symbol.
352-
bool isCommon() const {
353-
return SymbolContents == SymContentsCommon ||
354-
SymbolContents == SymContentsTargetCommon;
355-
}
356-
357-
/// Is this a target-specific common-like symbol.
358-
bool isTargetCommon() const {
359-
return SymbolContents == SymContentsTargetCommon;
360-
}
347+
bool isCommon() const { return kind == Kind::Common; }
361348

362349
MCFragment *getFragment() const {
363350
if (Fragment || !isVariable() || isWeakExternal())

llvm/lib/MC/ELFObjectWriter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,12 @@ void ELFWriter::computeSymbolTable(const RevGroupMapTy &RevGroupMap) {
541541
if (Symbol.isAbsolute()) {
542542
MSD.SectionIndex = ELF::SHN_ABS;
543543
} else if (Symbol.isCommon()) {
544-
if (Symbol.isTargetCommon()) {
545-
MSD.SectionIndex = Symbol.getIndex();
546-
} else {
544+
auto Shndx = Symbol.getIndex();
545+
if (!Shndx) {
547546
assert(!Local);
548-
MSD.SectionIndex = ELF::SHN_COMMON;
547+
Shndx = ELF::SHN_COMMON;
549548
}
549+
MSD.SectionIndex = Shndx;
550550
} else if (Symbol.isUndefined()) {
551551
if (Symbol.isSignature() && !Symbol.isUsedInReloc()) {
552552
MSD.SectionIndex = RevGroupMap.lookup(&Symbol);

0 commit comments

Comments
 (0)