Skip to content

Commit 8848f53

Browse files
authored
Merge branch 'main' into fix/113324-follow_up
2 parents 1b375a2 + 99dc396 commit 8848f53

File tree

2,378 files changed

+133746
-62294
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,378 files changed

+133746
-62294
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
# to receive an approval from a "code owner" in particular -- any LLVM project
88
# member can approve pull requests.
99
#
10-
# Note that GitHub's concept of "code owner" is independent from LLVM's own
11-
# "code owner" concept, they merely happen to share terminology. See
12-
# https://llvm.org/docs/DeveloperPolicy.html#code-owners, as well as the
13-
# CODE_OWNERS.txt files in the respective subproject directories.
10+
# This is independent of LLVM's own "maintainer" concept.
11+
# See https://llvm.org/docs/DeveloperPolicy.html#maintainers as well as the
12+
# Maintainers.* files in the the respective subproject directories.
1413

1514
/libcxx/ @llvm/reviewers-libcxx
1615
/libcxxabi/ @llvm/reviewers-libcxxabi

.github/workflows/docs.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,58 +112,87 @@ jobs:
112112
sudo apt-get update
113113
# swig and graphviz are lldb specific dependencies
114114
sudo apt-get install -y cmake ninja-build swig graphviz
115+
- name: Setup output folder
116+
run: mkdir built-docs
115117
- name: Build LLVM docs
116118
if: steps.docs-changed-subprojects.outputs.llvm_any_changed == 'true'
117119
run: |
118120
cmake -B llvm-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_SPHINX=ON ./llvm
119121
TZ=UTC ninja -C llvm-build docs-llvm-html docs-llvm-man
122+
mkdir built-docs/llvm
123+
cp -r llvm-build/docs/* built-docs/llvm/
120124
- name: Build Clang docs
121125
if: steps.docs-changed-subprojects.outputs.clang_any_changed == 'true'
122126
run: |
123127
cmake -B clang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_SPHINX=ON ./llvm
124128
TZ=UTC ninja -C clang-build docs-clang-html docs-clang-man
129+
mkdir built-docs/clang
130+
cp -r clang-build/docs/* built-docs/clang/
125131
- name: Build clang-tools-extra docs
126132
if: steps.docs-changed-subprojects.outputs.clang-tools-extra_any_changed == 'true'
127133
run: |
128134
cmake -B clang-tools-extra-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_ENABLE_SPHINX=ON ./llvm
129135
TZ=UTC ninja -C clang-tools-extra-build docs-clang-tools-html docs-clang-tools-man
136+
mkdir built-docs/clang-tools-extra
137+
cp -r clang-tools-extra-build/docs/* built-docs/clang-tools-extra/
130138
- name: Build LLDB docs
131139
if: steps.docs-changed-subprojects.outputs.lldb_any_changed == 'true'
132140
run: |
133141
cmake -B lldb-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_ENABLE_SPHINX=ON ./llvm
134142
TZ=UTC ninja -C lldb-build docs-lldb-html docs-lldb-man
143+
mkdir built-docs/lldb
144+
cp -r lldb-build/docs/* built-docs/lldb/
135145
- name: Build libunwind docs
136146
if: steps.docs-changed-subprojects.outputs.libunwind_any_changed == 'true'
137147
run: |
138148
cmake -B libunwind-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes
139149
TZ=UTC ninja -C libunwind-build docs-libunwind-html
150+
mkdir built-docs/libunwind
151+
cp -r libunwind-build/libunwind/docs/* built-docs/libunwind
140152
- name: Build libcxx docs
141153
if: steps.docs-changed-subprojects.outputs.libcxx_any_changed == 'true'
142154
run: |
143155
cmake -B libcxx-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx;libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes
144156
TZ=UTC ninja -C libcxx-build docs-libcxx-html
157+
mkdir built-docs/libcxx
158+
cp -r libcxx-build/libcxx/docs/* built-docs/libcxx/
145159
- name: Build libc docs
146160
if: steps.docs-changed-subprojects.outputs.libc_any_changed == 'true'
147161
run: |
148162
cmake -B libc-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc" -DLLVM_ENABLE_SPHINX=ON ./runtimes
149163
TZ=UTC ninja -C libc-build docs-libc-html
164+
mkdir built-docs/libc
165+
cp -r libc-build/libc/docs/* built-docs/libc/
150166
- name: Build LLD docs
151167
if: steps.docs-changed-subprojects.outputs.lld_any_changed == 'true'
152168
run: |
153169
cmake -B lld-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="lld" -DLLVM_ENABLE_SPHINX=ON ./llvm
154170
TZ=UTC ninja -C lld-build docs-lld-html
171+
mkdir built-docs/lld
172+
cp -r lld-build/docs/* built-docs/lld/
155173
- name: Build OpenMP docs
156174
if: steps.docs-changed-subprojects.outputs.openmp_any_changed == 'true'
157175
run: |
158176
cmake -B openmp-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;openmp" -DLLVM_ENABLE_SPHINX=ON ./llvm
159177
TZ=UTC ninja -C openmp-build docs-openmp-html
178+
mkdir built-docs/openmp
179+
cp -r openmp-build/docs/* built-docs/openmp/
160180
- name: Build Polly docs
161181
if: steps.docs-changed-subprojects.outputs.polly_any_changed == 'true'
162182
run: |
163183
cmake -B polly-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="polly" -DLLVM_ENABLE_SPHINX=ON ./llvm
164184
TZ=UTC ninja -C polly-build docs-polly-html docs-polly-man
185+
mkdir built-docs/polly
186+
cp -r polly-build/docs/* built-docs/polly/
165187
- name: Build Flang docs
166188
if: steps.docs-changed-subprojects.outputs.flang_any_changed == 'true'
167189
run: |
168190
cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON ./llvm
169191
TZ=UTC ninja -C flang-build docs-flang-html
192+
mkdir built-docs/flang
193+
cp -r flang-build/docs/* built-docs/flang/
194+
- name: Upload docs
195+
uses: actions/upload-artifact@v4
196+
with:
197+
name: docs-output
198+
path: built-docs/

.github/workflows/libcxx-restart-preempted-jobs.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,91 @@ jobs:
130130
run_id: context.payload.workflow_run.id
131131
})
132132
await create_check_run('success', 'Restarted workflow run due to preempted job')
133+
134+
restart-test:
135+
if: github.repository_owner == 'llvm' && (github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'cancelled') && github.event.actor.login == 'ldionne' # TESTING ONLY
136+
name: "Restart Job (test)"
137+
permissions:
138+
statuses: read
139+
checks: write
140+
actions: write
141+
runs-on: ubuntu-latest
142+
steps:
143+
- name: "Restart Job (test)"
144+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
145+
with:
146+
script: |
147+
const FAILURE_REGEX = /Process completed with exit code 1./
148+
const PREEMPTION_REGEX = /The runner has received a shutdown signal|The operation was canceled/
149+
150+
function log(msg) {
151+
core.notice(msg)
152+
}
153+
154+
const wf_run = context.payload.workflow_run
155+
log(`Running on "${wf_run.display_title}" by @${wf_run.actor.login} (event: ${wf_run.event})\nWorkflow run URL: ${wf_run.html_url}`)
156+
157+
log('Listing check runs for suite')
158+
const check_suites = await github.rest.checks.listForSuite({
159+
owner: context.repo.owner,
160+
repo: context.repo.repo,
161+
check_suite_id: context.payload.workflow_run.check_suite_id,
162+
per_page: 100 // FIXME: We don't have 100 check runs yet, but we should handle this better.
163+
})
164+
165+
preemptions = [];
166+
legitimate_failures = [];
167+
for (check_run of check_suites.data.check_runs) {
168+
log(`Checking check run: ${check_run.id}`);
169+
if (check_run.status != 'completed') {
170+
log('Check run was not completed. Skipping.');
171+
continue;
172+
}
173+
174+
if (check_run.conclusion != 'failure' && check_run.conclusion != 'cancelled') {
175+
log(`Check run had conclusion: ${check_run.conclusion}. Skipping.`);
176+
continue;
177+
}
178+
179+
annotations = await github.rest.checks.listAnnotations({
180+
owner: context.repo.owner,
181+
repo: context.repo.repo,
182+
check_run_id: check_run.id
183+
})
184+
185+
preemption_annotation = annotations.data.find(function(annotation) {
186+
return annotation.annotation_level == 'failure' &&
187+
annotation.message.match(PREEMPTION_REGEX) != null;
188+
});
189+
if (preemption_annotation != null) {
190+
log(`Found preemption message: ${preemption_annotation.message}`);
191+
preemptions.push(check_run);
192+
break;
193+
}
194+
195+
failure_annotation = annotations.data.find(function(annotation) {
196+
return annotation.annotation_level == 'failure' &&
197+
annotation.message.match(FAILURE_REGEX) != null;
198+
});
199+
if (failure_annotation != null) {
200+
log(`Found legitimate failure annotation: ${failure_annotation.message}`);
201+
legitimate_failures.push(check_run);
202+
break;
203+
}
204+
}
205+
206+
if (preemptions) {
207+
log('Found some preempted jobs');
208+
if (legitimate_failures) {
209+
log('Also found some legitimate failures, so not restarting the workflow.');
210+
} else {
211+
log('Did not find any legitimate failures. Restarting workflow.');
212+
await github.rest.actions.reRunWorkflowFailedJobs({
213+
owner: context.repo.owner,
214+
repo: context.repo.repo,
215+
run_id: context.payload.workflow_run.id
216+
})
217+
}
218+
} else {
219+
log('Did not find any preempted jobs. Not restarting the workflow.');
220+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ autoconf/autom4te.cache
5959
# VS2017 and VSCode config files.
6060
.vscode
6161
.vs
62+
#zed config files
63+
.zed
6264
# pythonenv for github Codespaces
6365
pythonenv*
6466
# clangd index. (".clangd" is a config file now, thus trailing slash)
File renamed without changes.

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "llvm/ADT/iterator.h"
2929
#include "llvm/BinaryFormat/Dwarf.h"
3030
#include "llvm/BinaryFormat/MachO.h"
31+
#include "llvm/ExecutionEngine/Orc/SymbolStringPool.h"
3132
#include "llvm/MC/MCAsmInfo.h"
3233
#include "llvm/MC/MCCodeEmitter.h"
3334
#include "llvm/MC/MCContext.h"
@@ -276,11 +277,10 @@ class BinaryContext {
276277
void deregisterSectionName(const BinarySection &Section);
277278

278279
public:
279-
static Expected<std::unique_ptr<BinaryContext>>
280-
createBinaryContext(Triple TheTriple, StringRef InputFileName,
281-
SubtargetFeatures *Features, bool IsPIC,
282-
std::unique_ptr<DWARFContext> DwCtx,
283-
JournalingStreams Logger);
280+
static Expected<std::unique_ptr<BinaryContext>> createBinaryContext(
281+
Triple TheTriple, std::shared_ptr<orc::SymbolStringPool> SSP,
282+
StringRef InputFileName, SubtargetFeatures *Features, bool IsPIC,
283+
std::unique_ptr<DWARFContext> DwCtx, JournalingStreams Logger);
284284

285285
/// Superset of compiler units that will contain overwritten code that needs
286286
/// new debug info. In a few cases, functions may end up not being
@@ -372,6 +372,7 @@ class BinaryContext {
372372
bool hasSymbolsWithFileName() const { return HasSymbolsWithFileName; }
373373
void setHasSymbolsWithFileName(bool Value) { HasSymbolsWithFileName = Value; }
374374

375+
std::shared_ptr<orc::SymbolStringPool> getSymbolStringPool() { return SSP; }
375376
/// Return true if relocations against symbol with a given name
376377
/// must be created.
377378
bool forceSymbolRelocations(StringRef SymbolName) const;
@@ -631,6 +632,8 @@ class BinaryContext {
631632

632633
std::unique_ptr<Triple> TheTriple;
633634

635+
std::shared_ptr<orc::SymbolStringPool> SSP;
636+
634637
const Target *TheTarget;
635638

636639
std::string TripleName;
@@ -807,8 +810,10 @@ class BinaryContext {
807810

808811
BinaryContext(std::unique_ptr<MCContext> Ctx,
809812
std::unique_ptr<DWARFContext> DwCtx,
810-
std::unique_ptr<Triple> TheTriple, const Target *TheTarget,
811-
std::string TripleName, std::unique_ptr<MCCodeEmitter> MCE,
813+
std::unique_ptr<Triple> TheTriple,
814+
std::shared_ptr<orc::SymbolStringPool> SSP,
815+
const Target *TheTarget, std::string TripleName,
816+
std::unique_ptr<MCCodeEmitter> MCE,
812817
std::unique_ptr<MCObjectFileInfo> MOFI,
813818
std::unique_ptr<const MCAsmInfo> AsmInfo,
814819
std::unique_ptr<const MCInstrInfo> MII,

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ class DataAggregator : public DataReader {
170170
std::string BuildIDBinaryName;
171171

172172
/// Memory map info for a single file as recorded in perf.data
173+
/// When a binary has multiple text segments, the Size is computed as the
174+
/// difference of the last address of these segments from the BaseAddress.
175+
/// The base addresses of all text segments must be the same.
173176
struct MMapInfo {
174177
uint64_t BaseAddress{0}; /// Base address of the mapped binary.
175178
uint64_t MMapAddress{0}; /// Address of the executable segment.
@@ -493,6 +496,11 @@ class DataAggregator : public DataReader {
493496
/// and return a file name matching a given \p FileBuildID.
494497
std::optional<StringRef> getFileNameForBuildID(StringRef FileBuildID);
495498

499+
/// Get a constant reference to the parsed binary mmap entries.
500+
const std::unordered_map<uint64_t, MMapInfo> &getBinaryMMapInfo() {
501+
return BinaryMMapInfo;
502+
}
503+
496504
friend class YAMLProfileWriter;
497505
};
498506
} // namespace bolt

bolt/lib/Core/BinaryContext.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ void BinaryContext::logBOLTErrorsAndQuitOnFatal(Error E) {
123123
BinaryContext::BinaryContext(std::unique_ptr<MCContext> Ctx,
124124
std::unique_ptr<DWARFContext> DwCtx,
125125
std::unique_ptr<Triple> TheTriple,
126+
std::shared_ptr<orc::SymbolStringPool> SSP,
126127
const Target *TheTarget, std::string TripleName,
127128
std::unique_ptr<MCCodeEmitter> MCE,
128129
std::unique_ptr<MCObjectFileInfo> MOFI,
@@ -136,12 +137,12 @@ BinaryContext::BinaryContext(std::unique_ptr<MCContext> Ctx,
136137
std::unique_ptr<MCDisassembler> DisAsm,
137138
JournalingStreams Logger)
138139
: Ctx(std::move(Ctx)), DwCtx(std::move(DwCtx)),
139-
TheTriple(std::move(TheTriple)), TheTarget(TheTarget),
140-
TripleName(TripleName), MCE(std::move(MCE)), MOFI(std::move(MOFI)),
141-
AsmInfo(std::move(AsmInfo)), MII(std::move(MII)), STI(std::move(STI)),
142-
InstPrinter(std::move(InstPrinter)), MIA(std::move(MIA)),
143-
MIB(std::move(MIB)), MRI(std::move(MRI)), DisAsm(std::move(DisAsm)),
144-
Logger(Logger), InitialDynoStats(isAArch64()) {
140+
TheTriple(std::move(TheTriple)), SSP(std::move(SSP)),
141+
TheTarget(TheTarget), TripleName(TripleName), MCE(std::move(MCE)),
142+
MOFI(std::move(MOFI)), AsmInfo(std::move(AsmInfo)), MII(std::move(MII)),
143+
STI(std::move(STI)), InstPrinter(std::move(InstPrinter)),
144+
MIA(std::move(MIA)), MIB(std::move(MIB)), MRI(std::move(MRI)),
145+
DisAsm(std::move(DisAsm)), Logger(Logger), InitialDynoStats(isAArch64()) {
145146
RegularPageSize = isAArch64() ? RegularPageSizeAArch64 : RegularPageSizeX86;
146147
PageAlign = opts::NoHugePages ? RegularPageSize : HugePageSize;
147148
}
@@ -159,8 +160,9 @@ BinaryContext::~BinaryContext() {
159160
/// Create BinaryContext for a given architecture \p ArchName and
160161
/// triple \p TripleName.
161162
Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
162-
Triple TheTriple, StringRef InputFileName, SubtargetFeatures *Features,
163-
bool IsPIC, std::unique_ptr<DWARFContext> DwCtx, JournalingStreams Logger) {
163+
Triple TheTriple, std::shared_ptr<orc::SymbolStringPool> SSP,
164+
StringRef InputFileName, SubtargetFeatures *Features, bool IsPIC,
165+
std::unique_ptr<DWARFContext> DwCtx, JournalingStreams Logger) {
164166
StringRef ArchName = "";
165167
std::string FeaturesStr = "";
166168
switch (TheTriple.getArch()) {
@@ -283,8 +285,8 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
283285

284286
auto BC = std::make_unique<BinaryContext>(
285287
std::move(Ctx), std::move(DwCtx), std::make_unique<Triple>(TheTriple),
286-
TheTarget, std::string(TripleName), std::move(MCE), std::move(MOFI),
287-
std::move(AsmInfo), std::move(MII), std::move(STI),
288+
std::move(SSP), TheTarget, std::string(TripleName), std::move(MCE),
289+
std::move(MOFI), std::move(AsmInfo), std::move(MII), std::move(STI),
288290
std::move(InstructionPrinter), std::move(MIA), nullptr, std::move(MRI),
289291
std::move(DisAsm), Logger);
290292

bolt/lib/Passes/VeneerElimination.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,17 @@ Error VeneerElimination::runOnFunctions(BinaryContext &BC) {
4646
if (BF.isIgnored())
4747
continue;
4848

49+
MCInst &FirstInstruction = *(BF.begin()->begin());
4950
const MCSymbol *VeneerTargetSymbol = 0;
5051
uint64_t TargetAddress;
51-
if (BC.MIB->matchAbsLongVeneer(BF, TargetAddress)) {
52+
if (BC.MIB->isTailCall(FirstInstruction)) {
53+
VeneerTargetSymbol = BC.MIB->getTargetSymbol(FirstInstruction);
54+
} else if (BC.MIB->matchAbsLongVeneer(BF, TargetAddress)) {
5255
if (BinaryFunction *TargetBF =
5356
BC.getBinaryFunctionAtAddress(TargetAddress))
5457
VeneerTargetSymbol = TargetBF->getSymbol();
55-
} else {
56-
MCInst &FirstInstruction = *(BF.begin()->begin());
57-
if (BC.MIB->hasAnnotation(FirstInstruction, "AArch64Veneer"))
58-
VeneerTargetSymbol = BC.MIB->getTargetSymbol(FirstInstruction, 1);
58+
} else if (BC.MIB->hasAnnotation(FirstInstruction, "AArch64Veneer")) {
59+
VeneerTargetSymbol = BC.MIB->getTargetSymbol(FirstInstruction, 1);
5960
}
6061

6162
if (!VeneerTargetSymbol)

0 commit comments

Comments
 (0)