Skip to content

Commit c89e76a

Browse files
authored
Merge branch 'llvm:main' into main
2 parents 6c1b256 + a8cb9db commit c89e76a

File tree

2,091 files changed

+99676
-29506
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,091 files changed

+99676
-29506
lines changed

.arcconfig

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

.arclint

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

.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: 1 addition & 2 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;

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/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
}

0 commit comments

Comments
 (0)