Skip to content

Commit 0d2fe31

Browse files
committed
LLVM and SPIRV-LLVM-Translator pulldown (WW10 2024)
LLVM: llvm/llvm-project@889d99a SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@3df5e38
2 parents 3d58edd + 2483d62 commit 0d2fe31

File tree

2,894 files changed

+137333
-49691
lines changed

Some content is hidden

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

2,894 files changed

+137333
-49691
lines changed

.arcconfig

Lines changed: 0 additions & 8 deletions
This file was deleted.

.arclint

Lines changed: 0 additions & 15 deletions
This file was deleted.

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming'
1+
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming,-misc-include-cleaner'
22
CheckOptions:
33
- key: readability-identifier-naming.ClassCase
44
value: CamelCase

.github/new-prs-labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,9 @@ backend:SystemZ:
869869
third-party:unittests:
870870
- third-party/unittests/**
871871

872+
third-party:benchmark:
873+
- third-party/benchmark/**
874+
872875
llvm:binary-utilities:
873876
- llvm/docs/CommandGuide/llvm-*
874877
- llvm/include/llvm/BinaryFormat/**

.github/workflows/build-ci-container.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,18 @@ jobs:
7777
cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf
7878
podman info
7979
80+
# Download the container image into /mnt/podman rather than
81+
# $GITHUB_WORKSPACE to avoid space limitations on the default drive
82+
# and use the permissions setup for /mnt/podman.
8083
- name: Download stage1-toolchain
8184
uses: actions/download-artifact@v4
8285
with:
8386
name: stage1-toolchain
87+
path: /mnt/podman
8488

8589
- name: Load stage1-toolchain
8690
run: |
87-
podman load -i stage1-toolchain.tar
91+
podman load -i /mnt/podman/stage1-toolchain.tar
8892
8993
- name: Build Container
9094
working-directory: ./.github/workflows/containers/github-action-ci/

.github/workflows/containers/github-action-ci/stage2.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ COPY --from=stage2-toolchain $LLVM_SYSROOT $LLVM_SYSROOT
1212
# Need to install curl for hendrikmuhs/ccache-action
1313
# Need nodejs for some of the GitHub actions.
1414
# Need perl-modules for clang analyzer tests.
15+
# Need git for SPIRV-Tools tests.
1516
RUN apt-get update && \
1617
apt-get install -y \
1718
binutils \
1819
cmake \
1920
curl \
21+
git \
2022
libstdc++-11-dev \
2123
ninja-build \
2224
nodejs \

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,14 @@ class BinaryFunction {
20562056
/// Returns false if disassembly failed.
20572057
Error disassemble();
20582058

2059+
/// An external interface to register a branch while the function is in
2060+
/// disassembled state. Allows to make custom modifications to the
2061+
/// disassembler. E.g., a pre-CFG pass can add an instruction and register
2062+
/// a branch that will later be used during the CFG construction.
2063+
///
2064+
/// Return a label at the branch destination.
2065+
MCSymbol *registerBranch(uint64_t Src, uint64_t Dst);
2066+
20592067
Error handlePCRelOperand(MCInst &Instruction, uint64_t Address,
20602068
uint64_t Size);
20612069

bolt/include/bolt/Core/ParallelUtilities.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "bolt/Core/MCPlusBuilder.h"
2020
#include "llvm/Support/CommandLine.h"
21+
#include "llvm/Support/ThreadPool.h"
2122

2223
using namespace llvm;
2324

@@ -28,8 +29,6 @@ extern cl::opt<unsigned> TaskCount;
2829
} // namespace opts
2930

3031
namespace llvm {
31-
class ThreadPool;
32-
3332
namespace bolt {
3433
class BinaryContext;
3534
class BinaryFunction;
@@ -50,8 +49,8 @@ enum SchedulingPolicy {
5049
SP_BB_QUADRATIC, /// cost is estimated by the square of the BB count
5150
};
5251

53-
/// Return the managed thread pool and initialize it if not initiliazed.
54-
ThreadPool &getThreadPool();
52+
/// Return the managed thread pool and initialize it if not initialized.
53+
ThreadPoolInterface &getThreadPool();
5554

5655
/// Perform the work on each BinaryFunction except those that are accepted
5756
/// by SkipPredicate, scheduling heuristic is based on SchedPolicy.

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,16 @@ Error BinaryFunction::disassemble() {
14451445
return Error::success();
14461446
}
14471447

1448+
MCSymbol *BinaryFunction::registerBranch(uint64_t Src, uint64_t Dst) {
1449+
assert(CurrentState == State::Disassembled &&
1450+
"Cannot register branch unless function is in disassembled state.");
1451+
assert(containsAddress(Src) && containsAddress(Dst) &&
1452+
"Cannot register external branch.");
1453+
MCSymbol *Target = getOrCreateLocalLabel(Dst);
1454+
TakenBranches.emplace_back(Src - getAddress(), Dst - getAddress());
1455+
return Target;
1456+
}
1457+
14481458
bool BinaryFunction::scanExternalRefs() {
14491459
bool Success = true;
14501460
bool DisassemblyFailed = false;
@@ -1759,13 +1769,6 @@ void BinaryFunction::postProcessJumpTables() {
17591769
}
17601770
}
17611771
}
1762-
1763-
// Remove duplicates branches. We can get a bunch of them from jump tables.
1764-
// Without doing jump table value profiling we don't have use for extra
1765-
// (duplicate) branches.
1766-
llvm::sort(TakenBranches);
1767-
auto NewEnd = std::unique(TakenBranches.begin(), TakenBranches.end());
1768-
TakenBranches.erase(NewEnd, TakenBranches.end());
17691772
}
17701773

17711774
bool BinaryFunction::validateExternallyReferencedOffsets() {
@@ -2128,6 +2131,13 @@ Error BinaryFunction::buildCFG(MCPlusBuilder::AllocatorIdTy AllocatorId) {
21282131
// e.g. exit(3), etc. Otherwise we'll see a false fall-through
21292132
// blocks.
21302133

2134+
// Remove duplicates branches. We can get a bunch of them from jump tables.
2135+
// Without doing jump table value profiling we don't have a use for extra
2136+
// (duplicate) branches.
2137+
llvm::sort(TakenBranches);
2138+
auto NewEnd = std::unique(TakenBranches.begin(), TakenBranches.end());
2139+
TakenBranches.erase(NewEnd, TakenBranches.end());
2140+
21312141
for (std::pair<uint32_t, uint32_t> &Branch : TakenBranches) {
21322142
LLVM_DEBUG(dbgs() << "registering branch [0x"
21332143
<< Twine::utohexstr(Branch.first) << "] -> [0x"

bolt/lib/Core/ParallelUtilities.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace ParallelUtilities {
4949

5050
namespace {
5151
/// A single thread pool that is used to run parallel tasks
52-
std::unique_ptr<ThreadPool> ThreadPoolPtr;
52+
std::unique_ptr<DefaultThreadPool> ThreadPoolPtr;
5353

5454
unsigned computeCostFor(const BinaryFunction &BF,
5555
const PredicateTy &SkipPredicate,
@@ -102,11 +102,11 @@ inline unsigned estimateTotalCost(const BinaryContext &BC,
102102

103103
} // namespace
104104

105-
ThreadPool &getThreadPool() {
105+
ThreadPoolInterface &getThreadPool() {
106106
if (ThreadPoolPtr.get())
107107
return *ThreadPoolPtr;
108108

109-
ThreadPoolPtr = std::make_unique<ThreadPool>(
109+
ThreadPoolPtr = std::make_unique<DefaultThreadPool>(
110110
llvm::hardware_concurrency(opts::ThreadCount));
111111
return *ThreadPoolPtr;
112112
}
@@ -145,7 +145,7 @@ void runOnEachFunction(BinaryContext &BC, SchedulingPolicy SchedPolicy,
145145
TotalCost > BlocksCount ? TotalCost / BlocksCount : 1;
146146

147147
// Divide work into blocks of equal cost
148-
ThreadPool &Pool = getThreadPool();
148+
ThreadPoolInterface &Pool = getThreadPool();
149149
auto BlockBegin = BC.getBinaryFunctions().begin();
150150
unsigned CurrentCost = 0;
151151

@@ -202,7 +202,7 @@ void runOnEachFunctionWithUniqueAllocId(
202202
TotalCost > BlocksCount ? TotalCost / BlocksCount : 1;
203203

204204
// Divide work into blocks of equal cost
205-
ThreadPool &Pool = getThreadPool();
205+
ThreadPoolInterface &Pool = getThreadPool();
206206
auto BlockBegin = BC.getBinaryFunctions().begin();
207207
unsigned CurrentCost = 0;
208208
unsigned AllocId = 1;

bolt/lib/Core/Relocation.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ static uint64_t encodeValueAArch64(uint64_t Type, uint64_t Value, uint64_t PC) {
381381
// OP 1001_01 goes in bits 31:26 of BL.
382382
Value = ((Value >> 2) & 0x3ffffff) | 0x94000000ULL;
383383
break;
384+
case ELF::R_AARCH64_JUMP26:
385+
Value -= PC;
386+
assert(isInt<28>(Value) &&
387+
"only PC +/- 128MB is allowed for direct branch");
388+
// Immediate goes in bits 25:0 of B.
389+
// OP 0001_01 goes in bits 31:26 of B.
390+
Value = ((Value >> 2) & 0x3ffffff) | 0x14000000ULL;
391+
break;
384392
}
385393
return Value;
386394
}

bolt/lib/Passes/IdenticalCodeFolding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ Error IdenticalCodeFolding::runOnFunctions(BinaryContext &BC) {
397397
Timer SinglePass("single fold pass", "single fold pass");
398398
LLVM_DEBUG(SinglePass.startTimer());
399399

400-
ThreadPool *ThPool;
400+
ThreadPoolInterface *ThPool;
401401
if (!opts::NoThreads)
402402
ThPool = &ParallelUtilities::getThreadPool();
403403

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ void DWARFRewriter::updateDebugInfo() {
784784
}
785785
} else {
786786
// Update unit debug info in parallel
787-
ThreadPool &ThreadPool = ParallelUtilities::getThreadPool();
787+
ThreadPoolInterface &ThreadPool = ParallelUtilities::getThreadPool();
788788
for (std::unique_ptr<DWARFUnit> &CU : BC.DwCtx->compile_units())
789789
ThreadPool.async(processUnitDIE, CU.get(), &DIEBlder);
790790
ThreadPool.wait();

0 commit comments

Comments
 (0)