Skip to content

Commit 93f3304

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-induction-resume-values
2 parents e292a3d + 6003be7 commit 93f3304

File tree

1,390 files changed

+65336
-39112
lines changed

Some content is hidden

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

1,390 files changed

+65336
-39112
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"
137+
permissions:
138+
statuses: read
139+
checks: write
140+
actions: write
141+
runs-on: ubuntu-latest
142+
steps:
143+
- name: "Restart Job"
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+
}
File renamed without changes.

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

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ cl::opt<bool> ReadPreAggregated(
9595
"pa", cl::desc("skip perf and read data from a pre-aggregated file format"),
9696
cl::cat(AggregatorCategory));
9797

98+
cl::opt<std::string>
99+
ReadPerfEvents("perf-script-events",
100+
cl::desc("skip perf event collection by supplying a "
101+
"perf-script output in a textual format"),
102+
cl::ReallyHidden, cl::init(""), cl::cat(AggregatorCategory));
103+
98104
static cl::opt<bool>
99105
TimeAggregator("time-aggr",
100106
cl::desc("time BOLT aggregator"),
@@ -167,8 +173,9 @@ void DataAggregator::findPerfExecutable() {
167173
void DataAggregator::start() {
168174
outs() << "PERF2BOLT: Starting data aggregation job for " << Filename << "\n";
169175

170-
// Don't launch perf for pre-aggregated files
171-
if (opts::ReadPreAggregated)
176+
// Don't launch perf for pre-aggregated files or when perf input is specified
177+
// by the user.
178+
if (opts::ReadPreAggregated || !opts::ReadPerfEvents.empty())
172179
return;
173180

174181
findPerfExecutable();
@@ -464,6 +471,13 @@ void DataAggregator::filterBinaryMMapInfo() {
464471

465472
int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process,
466473
PerfProcessErrorCallbackTy Callback) {
474+
if (!opts::ReadPerfEvents.empty()) {
475+
outs() << "PERF2BOLT: using pre-processed perf events for '" << Name
476+
<< "' (perf-script-events)\n";
477+
ParsingBuf = opts::ReadPerfEvents;
478+
return 0;
479+
}
480+
467481
std::string Error;
468482
outs() << "PERF2BOLT: waiting for perf " << Name
469483
<< " collection to finish...\n";
@@ -2056,15 +2070,6 @@ std::error_code DataAggregator::parseMMapEvents() {
20562070
if (FileMMapInfo.first == "(deleted)")
20572071
continue;
20582072

2059-
// Consider only the first mapping of the file for any given PID
2060-
auto Range = GlobalMMapInfo.equal_range(FileMMapInfo.first);
2061-
bool PIDExists = llvm::any_of(make_range(Range), [&](const auto &MI) {
2062-
return MI.second.PID == FileMMapInfo.second.PID;
2063-
});
2064-
2065-
if (PIDExists)
2066-
continue;
2067-
20682073
GlobalMMapInfo.insert(FileMMapInfo);
20692074
}
20702075

@@ -2116,12 +2121,22 @@ std::error_code DataAggregator::parseMMapEvents() {
21162121
<< " using file offset 0x" << Twine::utohexstr(MMapInfo.Offset)
21172122
<< ". Ignoring profile data for this mapping\n";
21182123
continue;
2119-
} else {
2120-
MMapInfo.BaseAddress = *BaseAddress;
21212124
}
2125+
MMapInfo.BaseAddress = *BaseAddress;
21222126
}
21232127

2124-
BinaryMMapInfo.insert(std::make_pair(MMapInfo.PID, MMapInfo));
2128+
// Try to add MMapInfo to the map and update its size. Large binaries may
2129+
// span to multiple text segments, so the mapping is inserted only on the
2130+
// first occurrence.
2131+
if (!BinaryMMapInfo.insert(std::make_pair(MMapInfo.PID, MMapInfo)).second)
2132+
assert(MMapInfo.BaseAddress == BinaryMMapInfo[MMapInfo.PID].BaseAddress &&
2133+
"Base address on multiple segment mappings should match");
2134+
2135+
// Update mapping size.
2136+
const uint64_t EndAddress = MMapInfo.MMapAddress + MMapInfo.Size;
2137+
const uint64_t Size = EndAddress - BinaryMMapInfo[MMapInfo.PID].BaseAddress;
2138+
if (Size > BinaryMMapInfo[MMapInfo.PID].Size)
2139+
BinaryMMapInfo[MMapInfo.PID].Size = Size;
21252140
}
21262141

21272142
if (BinaryMMapInfo.empty()) {

0 commit comments

Comments
 (0)