Skip to content

Commit 3fe511a

Browse files
committed
Merge branch 'main' into prvalue-explicit-object-member-function-call
2 parents cc2c637 + 3b99729 commit 3fe511a

File tree

2,698 files changed

+291588
-52764
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,698 files changed

+291588
-52764
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ function compute-projects-to-test() {
7474
fi
7575
;;
7676
clang)
77-
for p in clang-tools-extra compiler-rt lldb cross-project-tests; do
77+
# lldb is temporarily removed to alleviate Linux pre-commit CI waiting times
78+
for p in clang-tools-extra compiler-rt cross-project-tests; do
7879
echo $p
7980
done
8081
;;

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
with:
101101
fetch-depth: 1
102102
- name: Setup Python env
103-
uses: actions/setup-python@v4
103+
uses: actions/setup-python@v5
104104
with:
105105
python-version: '3.11'
106106
cache: 'pip'

.github/workflows/libclang-python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
strategy:
3737
fail-fast: false
3838
matrix:
39-
python-version: ["3.7", "3.11"]
39+
python-version: ["3.8", "3.11"]
4040
uses: ./.github/workflows/llvm-project-tests.yml
4141
with:
4242
build_target: check-clang-python

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,16 @@ jobs:
209209
- uses: actions/checkout@v4
210210
- name: Install dependencies
211211
run: |
212-
choco install -y ninja wget
212+
choco install -y ninja
213213
pip install psutil
214214
- name: Install a current LLVM
215215
if: ${{ matrix.mingw != true }}
216216
run: |
217-
choco install -y llvm --version=17.0.6
217+
choco install -y llvm --version=18.1.6 --allow-downgrade
218218
- name: Install llvm-mingw
219219
if: ${{ matrix.mingw == true }}
220220
run: |
221-
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-x86_64.zip
221+
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20240606/llvm-mingw-20240606-ucrt-x86_64.zip
222222
powershell Expand-Archive llvm-mingw*.zip -DestinationPath .
223223
del llvm-mingw*.zip
224224
mv llvm-mingw* c:\llvm-mingw

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
script: |
3535
const failure_regex = /Process completed with exit code 1./
3636
const preemption_regex = /The runner has received a shutdown signal/
37-
37+
3838
const wf_run = context.payload.workflow_run
3939
core.notice(`Running on "${wf_run.display_title}" by @${wf_run.actor.login} (event: ${wf_run.event})\nWorkflow run URL: ${wf_run.html_url}`)
4040
@@ -80,30 +80,30 @@ jobs:
8080
}
8181
check_run_ids.push(check_run.id);
8282
}
83-
83+
8484
has_preempted_job = false;
8585
8686
for (check_run_id of check_run_ids) {
8787
console.log('Listing annotations for check run: ' + check_run_id);
88-
88+
8989
annotations = await github.rest.checks.listAnnotations({
9090
owner: context.repo.owner,
9191
repo: context.repo.repo,
9292
check_run_id: check_run_id
9393
})
94-
94+
9595
for (annotation of annotations.data) {
9696
if (annotation.annotation_level != 'failure') {
9797
continue;
9898
}
99-
99+
100100
const preemption_match = annotation.message.match(preemption_regex);
101-
101+
102102
if (preemption_match != null) {
103103
console.log('Found preemption message: ' + annotation.message);
104104
has_preempted_job = true;
105105
}
106-
106+
107107
const failure_match = annotation.message.match(failure_regex);
108108
if (failure_match != null) {
109109
// We only want to restart the workflow if all of the failures were due to preemption.
@@ -115,20 +115,18 @@ jobs:
115115
return;
116116
}
117117
}
118-
}
119-
118+
}
119+
120120
if (!has_preempted_job) {
121121
core.notice('No preempted jobs found. Not restarting workflow.');
122122
await create_check_run('neutral', 'No preempted jobs found. Not restarting workflow.')
123123
return;
124124
}
125-
125+
126126
core.notice("Restarted workflow: " + context.payload.workflow_run.id);
127127
await github.rest.actions.reRunWorkflowFailedJobs({
128128
owner: context.repo.owner,
129129
repo: context.repo.repo,
130130
run_id: context.payload.workflow_run.id
131131
})
132132
await create_check_run('success', 'Restarted workflow run due to preempted job')
133-
134-

.github/workflows/llvm-project-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
# lldb. Using this setup-python action to make 3.10 the default
7878
# python fixes this.
7979
- name: Setup Python
80-
uses: actions/setup-python@v4
80+
uses: actions/setup-python@v5
8181
with:
8282
python-version: ${{ inputs.python_version }}
8383
- name: Install Ninja

.github/workflows/pr-code-format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ jobs:
5555
- name: Install clang-format
5656
uses: aminya/setup-cpp@v1
5757
with:
58-
clangformat: 18.1.1
58+
clangformat: 18.1.7
5959

6060
- name: Setup Python env
61-
uses: actions/setup-python@v4
61+
uses: actions/setup-python@v5
6262
with:
6363
python-version: '3.11'
6464
cache: 'pip'

.github/workflows/release-documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3838

3939
- name: Setup Python env
40-
uses: actions/setup-python@v4
40+
uses: actions/setup-python@v5
4141
with:
4242
cache: 'pip'
4343
cache-dependency-path: './llvm/docs/requirements.txt'

.github/workflows/release-doxygen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4040

4141
- name: Setup Python env
42-
uses: actions/setup-python@v4
42+
uses: actions/setup-python@v5
4343
with:
4444
cache: 'pip'
4545
cache-dependency-path: './llvm/docs/requirements.txt'

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,13 +1412,14 @@ class MCPlusBuilder {
14121412
return false;
14131413
}
14141414

1415-
/// Modify a direct call instruction \p Inst with an indirect call taking
1416-
/// a destination from a memory location pointed by \p TargetLocation symbol.
1417-
virtual bool convertCallToIndirectCall(MCInst &Inst,
1418-
const MCSymbol *TargetLocation,
1419-
MCContext *Ctx) {
1415+
/// Creates an indirect call to the function within the \p DirectCall PLT
1416+
/// stub. The function's memory location is pointed by the \p TargetLocation
1417+
/// symbol.
1418+
virtual InstructionListType
1419+
createIndirectPltCall(const MCInst &DirectCall,
1420+
const MCSymbol *TargetLocation, MCContext *Ctx) {
14201421
llvm_unreachable("not implemented");
1421-
return false;
1422+
return {};
14221423
}
14231424

14241425
/// Morph an indirect call into a load where \p Reg holds the call target.

bolt/include/bolt/Rewrite/DWARFRewriter.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "bolt/Core/DIEBuilder.h"
1313
#include "bolt/Core/DebugData.h"
1414
#include "bolt/Core/DebugNames.h"
15+
#include "bolt/Core/GDBIndex.h"
1516
#include "llvm/ADT/StringRef.h"
1617
#include "llvm/CodeGen/DIE.h"
1718
#include "llvm/DWP/DWP.h"
@@ -131,7 +132,8 @@ class DWARFRewriter {
131132
makeFinalLocListsSection(DWARFVersion Version);
132133

133134
/// Finalize type sections in the main binary.
134-
CUOffsetMap finalizeTypeSections(DIEBuilder &DIEBlder, DIEStreamer &Streamer);
135+
CUOffsetMap finalizeTypeSections(DIEBuilder &DIEBlder, DIEStreamer &Streamer,
136+
GDBIndex &GDBIndexSection);
135137

136138
/// Process and write out CUs that are passsed in.
137139
void finalizeCompileUnits(DIEBuilder &DIEBlder, DIEStreamer &Streamer,
@@ -148,9 +150,6 @@ class DWARFRewriter {
148150
/// blocks) to be updated.
149151
void updateDebugAddressRanges();
150152

151-
/// Rewrite .gdb_index section if present.
152-
void updateGdbIndexSection(CUOffsetMap &CUMap, uint32_t NumCUs);
153-
154153
/// DWARFDie contains a pointer to a DIE and hence gets invalidated once the
155154
/// embedded DIE is destroyed. This wrapper class stores a DIE internally and
156155
/// could be cast to a DWARFDie that is valid even after the initial DIE is
@@ -192,14 +191,6 @@ class DWARFRewriter {
192191
DwoRangesBase[DWOId] = RangesBase;
193192
}
194193

195-
/// Adds an GDBIndexTUEntry if .gdb_index seciton exists.
196-
void addGDBTypeUnitEntry(const GDBIndexTUEntry &&Entry);
197-
198-
/// Returns all entries needed for Types CU list
199-
const GDBIndexTUEntryType &getGDBIndexTUEntryVector() const {
200-
return GDBIndexTUEntryVector;
201-
}
202-
203194
using OverriddenSectionsMap = std::unordered_map<DWARFSectionKind, StringRef>;
204195
/// Output .dwo files.
205196
void writeDWOFiles(DWARFUnit &, const OverriddenSectionsMap &,

bolt/lib/Passes/PLTCall.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ Error PLTCall::runOnFunctions(BinaryContext &BC) {
4848
return Error::success();
4949

5050
uint64_t NumCallsOptimized = 0;
51-
for (auto &It : BC.getBinaryFunctions()) {
52-
BinaryFunction &Function = It.second;
51+
for (auto &BFI : BC.getBinaryFunctions()) {
52+
BinaryFunction &Function = BFI.second;
5353
if (!shouldOptimize(Function))
5454
continue;
5555

@@ -61,18 +61,21 @@ Error PLTCall::runOnFunctions(BinaryContext &BC) {
6161
if (opts::PLT == OT_HOT && !BB.getKnownExecutionCount())
6262
continue;
6363

64-
for (MCInst &Instr : BB) {
65-
if (!BC.MIB->isCall(Instr))
64+
for (auto II = BB.begin(); II != BB.end(); II++) {
65+
if (!BC.MIB->isCall(*II))
6666
continue;
67-
const MCSymbol *CallSymbol = BC.MIB->getTargetSymbol(Instr);
67+
const MCSymbol *CallSymbol = BC.MIB->getTargetSymbol(*II);
6868
if (!CallSymbol)
6969
continue;
7070
const BinaryFunction *CalleeBF = BC.getFunctionForSymbol(CallSymbol);
7171
if (!CalleeBF || !CalleeBF->isPLTFunction())
7272
continue;
73-
BC.MIB->convertCallToIndirectCall(Instr, CalleeBF->getPLTSymbol(),
74-
BC.Ctx.get());
75-
BC.MIB->addAnnotation(Instr, "PLTCall", true);
73+
const InstructionListType NewCode = BC.MIB->createIndirectPltCall(
74+
*II, CalleeBF->getPLTSymbol(), BC.Ctx.get());
75+
II = BB.replaceInstruction(II, NewCode);
76+
assert(!NewCode.empty() && "PLT Call replacement must be non-empty");
77+
std::advance(II, NewCode.size() - 1);
78+
BC.MIB->addAnnotation(*II, "PLTCall", true);
7679
++NumCallsOptimized;
7780
}
7881
}

0 commit comments

Comments
 (0)