Skip to content

Commit db9162d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into dxil-flatten-array-geps
2 parents 3734f57 + 20b3ab5 commit db9162d

File tree

2,774 files changed

+85681
-37808
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,774 files changed

+85681
-37808
lines changed

.ci/monolithic-linux.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ runtime_targets_needs_reconfig="${5}"
5656

5757
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5858

59-
echo "--- cmake"
59+
echo "::group::cmake"
6060
export PIP_BREAK_SYSTEM_PACKAGES=1
6161
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
6262

@@ -85,38 +85,49 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
8585
-D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
8686
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
8787

88-
echo "--- ninja"
88+
echo "::endgroup::"
89+
echo "::group::ninja"
90+
8991
# Targets are not escaped as they are passed as separate arguments.
9092
ninja -C "${BUILD_DIR}" -k 0 ${targets}
9193

94+
echo "::endgroup::"
95+
9296
if [[ "${runtime_targets}" != "" ]]; then
93-
echo "--- ninja runtimes"
97+
echo "::group::ninja runtimes"
9498

9599
ninja -C "${BUILD_DIR}" ${runtime_targets}
100+
101+
echo "::endgroup::"
96102
fi
97103

98104
# Compiling runtimes with just-built Clang and running their tests
99105
# as an additional testing for Clang.
100106
if [[ "${runtime_targets_needs_reconfig}" != "" ]]; then
101-
echo "--- cmake runtimes C++26"
107+
echo "::group::cmake runtimes C++26"
102108

103109
cmake \
104110
-D LIBCXX_TEST_PARAMS="std=c++26" \
105111
-D LIBCXXABI_TEST_PARAMS="std=c++26" \
106112
"${BUILD_DIR}"
107113

108-
echo "--- ninja runtimes C++26"
114+
echo "::endgroup::"
115+
echo "::group::ninja runtimes C++26"
109116

110117
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
111118

112-
echo "--- cmake runtimes clang modules"
119+
echo "::endgroup::"
120+
echo "::group::cmake runtimes clang modules"
113121

114122
cmake \
115123
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
116124
-D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
117125
"${BUILD_DIR}"
118126

119-
echo "--- ninja runtimes clang modules"
127+
echo "::endgroup::"
128+
echo "::group::ninja runtimes clang modules"
120129

121130
ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig}
131+
132+
echo "::endgroup::"
122133
fi

.ci/monolithic-windows.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ trap at-exit EXIT
4646
projects="${1}"
4747
targets="${2}"
4848

49-
echo "--- cmake"
49+
echo "::group::cmake"
5050
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
5151

5252
export CC=cl
@@ -78,6 +78,10 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7878
-D LLVM_PARALLEL_COMPILE_JOBS=${MAX_PARALLEL_COMPILE_JOBS} \
7979
-D LLVM_PARALLEL_LINK_JOBS=${MAX_PARALLEL_LINK_JOBS}
8080

81-
echo "--- ninja"
81+
echo "::endgroup::"
82+
echo "::group::ninja"
83+
8284
# Targets are not escaped as they are passed as separate arguments.
8385
ninja -C "${BUILD_DIR}" -k 0 ${targets}
86+
87+
echo "::endgroup"

.github/copilot-instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
When performing a code review, pay close attention to code modifying a function's
2+
control flow. Could the change result in the corruption of performance profile
3+
data? Could the change result in invalid debug information, in particular for
4+
branches and calls?

.github/workflows/hlsl-test-all.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ jobs:
4343
- name: Checkout OffloadTest
4444
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4545
with:
46-
repository: llvm-beanz/offload-test-suite
46+
repository: llvm/offload-test-suite
4747
ref: main
4848
path: OffloadTest
4949
- name: Checkout Golden Images
5050
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
5151
with:
52-
repository: llvm-beanz/offload-golden-images
52+
repository: llvm/offload-golden-images
5353
ref: main
5454
path: golden-images
5555
- name: Setup Windows

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

Lines changed: 6 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ permissions:
2020

2121
jobs:
2222
restart:
23-
if: github.repository_owner == 'llvm' && (github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'cancelled')
23+
if: github.repository_owner == 'llvm' && (github.event.workflow_run.conclusion == 'failure')
2424
name: "Restart Job"
2525
permissions:
2626
statuses: read
@@ -32,7 +32,10 @@ jobs:
3232
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
3333
with:
3434
script: |
35-
const failure_regex = /Process completed with exit code 1./
35+
// The "The run was canceled by" message comes from a user manually canceling a workflow
36+
// the "higher priority" message comes from github canceling a workflow because the user updated the change.
37+
// And the "exit code 1" message indicates a genuine failure.
38+
const failure_regex = /(Process completed with exit code 1.)/
3639
const preemption_regex = /(The runner has received a shutdown signal)|(The operation was canceled)/
3740
3841
const wf_run = context.payload.workflow_run
@@ -74,7 +77,7 @@ jobs:
7477
console.log('Check run was not completed. Skipping.');
7578
continue;
7679
}
77-
if (check_run.conclusion != 'failure' && check_run.conclusion != 'cancelled') {
80+
if (check_run.conclusion != 'failure') {
7881
console.log('Check run had conclusion: ' + check_run.conclusion + '. Skipping.');
7982
continue;
8083
}
@@ -153,91 +156,3 @@ jobs:
153156
run_id: context.payload.workflow_run.id
154157
})
155158
await create_check_run('success', 'Restarted workflow run due to preempted job')
156-
157-
restart-test:
158-
if: github.repository_owner == 'llvm' && (github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'cancelled') && github.event.actor.login == 'ldionne' # TESTING ONLY
159-
name: "Restart Job (test)"
160-
permissions:
161-
statuses: read
162-
checks: write
163-
actions: write
164-
runs-on: ubuntu-24.04
165-
steps:
166-
- name: "Restart Job (test)"
167-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
168-
with:
169-
script: |
170-
const FAILURE_REGEX = /Process completed with exit code 1./
171-
const PREEMPTION_REGEX = /(The runner has received a shutdown signal)|(The operation was canceled)/
172-
173-
function log(msg) {
174-
core.notice(msg)
175-
}
176-
177-
const wf_run = context.payload.workflow_run
178-
log(`Running on "${wf_run.display_title}" by @${wf_run.actor.login} (event: ${wf_run.event})\nWorkflow run URL: ${wf_run.html_url}`)
179-
180-
log('Listing check runs for suite')
181-
const check_suites = await github.rest.checks.listForSuite({
182-
owner: context.repo.owner,
183-
repo: context.repo.repo,
184-
check_suite_id: context.payload.workflow_run.check_suite_id,
185-
per_page: 100 // FIXME: We don't have 100 check runs yet, but we should handle this better.
186-
})
187-
188-
preemptions = [];
189-
legitimate_failures = [];
190-
for (check_run of check_suites.data.check_runs) {
191-
log(`Checking check run: ${check_run.id}`);
192-
if (check_run.status != 'completed') {
193-
log('Check run was not completed. Skipping.');
194-
continue;
195-
}
196-
197-
if (check_run.conclusion != 'failure' && check_run.conclusion != 'cancelled') {
198-
log(`Check run had conclusion: ${check_run.conclusion}. Skipping.`);
199-
continue;
200-
}
201-
202-
annotations = await github.rest.checks.listAnnotations({
203-
owner: context.repo.owner,
204-
repo: context.repo.repo,
205-
check_run_id: check_run.id
206-
})
207-
208-
preemption_annotation = annotations.data.find(function(annotation) {
209-
return annotation.annotation_level == 'failure' &&
210-
annotation.message.match(PREEMPTION_REGEX) != null;
211-
});
212-
if (preemption_annotation != null) {
213-
log(`Found preemption message: ${preemption_annotation.message}`);
214-
preemptions.push(check_run);
215-
break;
216-
}
217-
218-
failure_annotation = annotations.data.find(function(annotation) {
219-
return annotation.annotation_level == 'failure' &&
220-
annotation.message.match(FAILURE_REGEX) != null;
221-
});
222-
if (failure_annotation != null) {
223-
log(`Found legitimate failure annotation: ${failure_annotation.message}`);
224-
legitimate_failures.push(check_run);
225-
break;
226-
}
227-
}
228-
229-
if (preemptions) {
230-
log('Found some preempted jobs');
231-
if (legitimate_failures) {
232-
log('Also found some legitimate failures, so not restarting the workflow.');
233-
} else {
234-
log('Did not find any legitimate failures. Restarting workflow.');
235-
await github.rest.actions.reRunWorkflowFailedJobs({
236-
owner: context.repo.owner,
237-
repo: context.repo.repo,
238-
run_id: context.payload.workflow_run.id
239-
})
240-
}
241-
} else {
242-
log('Did not find any preempted jobs. Not restarting the workflow.');
243-
}

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,15 @@ struct SegmentInfo {
7373
uint64_t FileSize; /// Size in file.
7474
uint64_t Alignment; /// Alignment of the segment.
7575
bool IsExecutable; /// Is the executable bit set on the Segment?
76+
bool IsWritable; /// Is the segment writable.
7677

7778
void print(raw_ostream &OS) const {
7879
OS << "SegmentInfo { Address: 0x" << Twine::utohexstr(Address)
7980
<< ", Size: 0x" << Twine::utohexstr(Size) << ", FileOffset: 0x"
8081
<< Twine::utohexstr(FileOffset) << ", FileSize: 0x"
8182
<< Twine::utohexstr(FileSize) << ", Alignment: 0x"
82-
<< Twine::utohexstr(Alignment) << ", " << (IsExecutable ? "x" : " ")
83-
<< "}";
83+
<< Twine::utohexstr(Alignment) << ", " << (IsExecutable ? "x" : "")
84+
<< (IsWritable ? "w" : "") << " }";
8485
};
8586
};
8687

@@ -333,9 +334,14 @@ class BinaryContext {
333334
std::optional<StringRef> Source,
334335
unsigned CUID, unsigned DWARFVersion);
335336

337+
/// Input file segment info
338+
///
336339
/// [start memory address] -> [segment info] mapping.
337340
std::map<uint64_t, SegmentInfo> SegmentMapInfo;
338341

342+
/// Newly created segments.
343+
std::vector<SegmentInfo> NewSegments;
344+
339345
/// Symbols that are expected to be undefined in MCContext during emission.
340346
std::unordered_set<MCSymbol *> UndefinedSymbols;
341347

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ class MCPlusBuilder {
13931393
return getTargetSymbol(BinaryExpr->getLHS());
13941394

13951395
auto *SymbolRefExpr = dyn_cast<const MCSymbolRefExpr>(Expr);
1396-
if (SymbolRefExpr && SymbolRefExpr->getKind() == MCSymbolRefExpr::VK_None)
1396+
if (SymbolRefExpr && SymbolRefExpr->getSpecifier() == 0)
13971397
return &SymbolRefExpr->getSymbol();
13981398

13991399
return nullptr;

bolt/include/bolt/Rewrite/RewriteInstance.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ class RewriteInstance {
202202
/// Map code sections generated by BOLT.
203203
void mapCodeSections(BOLTLinker::SectionMapper MapSection);
204204

205+
/// Map code without relocating sections.
206+
void mapCodeSectionsInPlace(BOLTLinker::SectionMapper MapSection);
207+
205208
/// Map the rest of allocatable sections.
206209
void mapAllocatableSections(BOLTLinker::SectionMapper MapSection);
207210

@@ -297,6 +300,9 @@ class RewriteInstance {
297300
return FUNC(ELF64BE); \
298301
}
299302

303+
/// Update loadable segment information based on new sections.
304+
void updateSegmentInfo();
305+
300306
/// Patch ELF book-keeping info.
301307
void patchELFPHDRTable();
302308

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3328,10 +3328,7 @@ void BinaryFunction::duplicateConstantIslands() {
33283328

33293329
// Update instruction reference
33303330
Operand = MCOperand::createExpr(BC.MIB->getTargetExprFor(
3331-
Inst,
3332-
MCSymbolRefExpr::create(ColdSymbol, MCSymbolRefExpr::VK_None,
3333-
*BC.Ctx),
3334-
*BC.Ctx, 0));
3331+
Inst, MCSymbolRefExpr::create(ColdSymbol, *BC.Ctx), *BC.Ctx, 0));
33353332
++OpNum;
33363333
}
33373334
}

bolt/lib/Passes/Instrumentation.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,7 @@ Error Instrumentation::runOnFunctions(BinaryContext &BC) {
666666
auto IsLEA = [&BC](const MCInst &Inst) { return BC.MIB->isLEA64r(Inst); };
667667
const auto LEA = std::find_if(
668668
std::next(llvm::find_if(reverse(BB), IsLEA)), BB.rend(), IsLEA);
669-
LEA->getOperand(4).setExpr(
670-
MCSymbolRefExpr::create(Target, MCSymbolRefExpr::VK_None, *BC.Ctx));
669+
LEA->getOperand(4).setExpr(MCSymbolRefExpr::create(Target, *BC.Ctx));
671670
} else {
672671
BC.errs() << "BOLT-WARNING: ___GLOBAL_init_65535 not found\n";
673672
}

0 commit comments

Comments
 (0)