Skip to content

Commit d8ef6d0

Browse files
committed
Merge branch 'main' into libcxx-overriden-function-detection
2 parents 867dd0c + d866005 commit d8ef6d0

File tree

2,658 files changed

+10060
-6413
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,658 files changed

+10060
-6413
lines changed

.ci/monolithic-linux.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ function at-exit {
3434

3535
# If building fails there will be no results files.
3636
shopt -s nullglob
37-
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":linux: Linux x64 Test Results" \
38-
"linux-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
37+
if command -v buildkite-agent 2>&1 >/dev/null
38+
then
39+
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":linux: Linux x64 Test Results" \
40+
"linux-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
41+
fi
3942
}
4043
trap at-exit EXIT
4144

.ci/monolithic-windows.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ function at-exit {
3333

3434
# If building fails there will be no results files.
3535
shopt -s nullglob
36-
python "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":windows: Windows x64 Test Results" \
37-
"windows-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
36+
if command -v buildkite-agent 2>&1 >/dev/null
37+
then
38+
python "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":windows: Windows x64 Test Results" \
39+
"windows-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
40+
fi
3841
}
3942
trap at-exit EXIT
4043

bolt/include/bolt/Passes/ADRRelaxationPass.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ namespace bolt {
2525

2626
class ADRRelaxationPass : public BinaryFunctionPass {
2727
public:
28-
explicit ADRRelaxationPass() : BinaryFunctionPass(false) {}
28+
explicit ADRRelaxationPass(const cl::opt<bool> &PrintPass)
29+
: BinaryFunctionPass(PrintPass) {}
2930

3031
const char *getName() const override { return "adr-relaxation"; }
3132

bolt/lib/Passes/LongJmp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ BinaryBasicBlock *LongJmpPass::lookupStubFromGroup(
138138
const std::pair<uint64_t, BinaryBasicBlock *> &RHS) {
139139
return LHS.first < RHS.first;
140140
});
141-
if (Cand == Candidates.end())
142-
return nullptr;
143-
if (Cand != Candidates.begin()) {
141+
if (Cand == Candidates.end()) {
142+
Cand = std::prev(Cand);
143+
} else if (Cand != Candidates.begin()) {
144144
const StubTy *LeftCand = std::prev(Cand);
145145
if (Cand->first - DotAddress > DotAddress - LeftCand->first)
146146
Cand = LeftCand;

bolt/lib/Rewrite/BinaryPassManager.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ static cl::opt<bool> PrintJTFootprintReduction(
126126
cl::desc("print function after jt-footprint-reduction pass"), cl::Hidden,
127127
cl::cat(BoltOptCategory));
128128

129+
static cl::opt<bool>
130+
PrintAdrRelaxation("print-adr-relaxation",
131+
cl::desc("print functions after ADR Relaxation pass"),
132+
cl::Hidden, cl::cat(BoltOptCategory));
133+
129134
static cl::opt<bool>
130135
PrintLongJmp("print-longjmp",
131136
cl::desc("print functions after longjmp pass"), cl::Hidden,
@@ -493,7 +498,8 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
493498
Manager.registerPass(std::make_unique<ReorderData>());
494499

495500
if (BC.isAArch64()) {
496-
Manager.registerPass(std::make_unique<ADRRelaxationPass>());
501+
Manager.registerPass(
502+
std::make_unique<ADRRelaxationPass>(PrintAdrRelaxation));
497503

498504
// Tighten branches according to offset differences between branch and
499505
// targets. No extra instructions after this pass, otherwise we may have
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## This test verifies that no unnecessary stubs are inserted when each DotAddress increases during a lookup.
2+
3+
# REQUIRES: system-linux, asserts
4+
5+
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
6+
# RUN: %clang %cflags -O0 %t.o -o %t.exe -Wl,-q
7+
# RUN: link_fdata %s %t.o %t.fdata
8+
# RUN: llvm-bolt %t.exe -o %t.bolt \
9+
# RUN: --data %t.fdata | FileCheck %s
10+
11+
# CHECK: BOLT-INFO: Inserted 1 stubs in the hot area and 0 stubs in the cold area.
12+
13+
.section .text
14+
.global _start
15+
.global far_away_func
16+
17+
.align 4
18+
.global _start
19+
.type _start, %function
20+
_start:
21+
# FDATA: 0 [unknown] 0 1 _start 0 0 100
22+
bl far_away_func
23+
bl far_away_func
24+
ret
25+
.space 0x8000000
26+
.global far_away_func
27+
.type far_away_func, %function
28+
far_away_func:
29+
add x0, x0, #1
30+
ret
31+
32+
.reloc 0, R_AARCH64_NONE

bolt/test/X86/linux-static-keys.s

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ _start:
3535
.L0:
3636
jmp L1
3737
# CHECK: jit
38-
# CHECK-SAME: # ID: 1 {{.*}} # Likely: 0 # InitValue: 1
38+
# CHECK-SAME: # ID: 1 {{.*}} # Likely: 1 # InitValue: 0
3939
nop
4040
L1:
4141
.nops 5
42-
jmp .L0
4342
# CHECK: jit
44-
# CHECK-SAME: # ID: 2 {{.*}} # Likely: 1 # InitValue: 1
43+
# CHECK-SAME: # ID: 2 {{.*}} # Likely: 0 # InitValue: 0
44+
jmp .L0
4545

4646
## Check that a branch profile associated with a NOP is handled properly when
4747
## dynamic branch is created.
@@ -67,18 +67,24 @@ foo:
6767
.type __start___jump_table, %object
6868
__start___jump_table:
6969

70-
.long .L0 - . # Jump address
71-
.long L1 - . # Target address
72-
.quad 1 # Key address
70+
.long .L0 - . # Jump address
71+
.long L1 - . # Target address
72+
.quad fake_static_key + 1 - . # Key address; LSB = 1 : likely
7373

74-
.long L1 - . # Jump address
75-
.long L2 - . # Target address
76-
.quad 0 # Key address
74+
.long L1 - . # Jump address
75+
.long L2 - . # Target address
76+
.quad fake_static_key -. # Key address; LSB = 0 : unlikely
7777

7878
.globl __stop___jump_table
7979
.type __stop___jump_table, %object
8080
__stop___jump_table:
8181

82+
## Staic keys (we just use the label ignoring the format of the keys).
83+
.data
84+
.align 8
85+
fake_static_key:
86+
.quad 0
87+
8288
## Fake Linux Kernel sections.
8389
.section __ksymtab,"a",@progbits
8490
.section __ksymtab_gpl,"a",@progbits

bolt/test/merge-fdata-lbr-mode.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
# RUN: FileCheck %s --input-file %t/merged.fdata
88

99
# CHECK-NOT: no_lbr
10-
# CHECK: main 2
10+
# CHECK: 1 main 0 1 main 2 1 3
1111

1212
#--- a.fdata
13-
main 1
13+
1 main 0 1 main 2 0 1
1414
#--- b.fdata
15-
main 1
15+
1 main 0 1 main 2 1 2

bolt/test/merge-fdata-mixed-bat-no-lbr.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# RUN: split-file %s %t
66
# RUN: not merge-fdata %t/a.fdata %t/b.fdata 2>&1 | FileCheck %s
77

8-
# CHECK: cannot mix profile collected in BOLT and non-BOLT deployments
8+
# CHECK: cannot mix profile with and without boltedcollection
99

1010
#--- a.fdata
1111
boltedcollection

bolt/test/merge-fdata-mixed-mode.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# RUN: split-file %s %t
77
# RUN: not merge-fdata %t/a.fdata %t/b.fdata 2>&1 | FileCheck %s
88

9-
# CHECK: cannot mix 'no_lbr' and 'lbr' profiles.
9+
# CHECK: cannot mix profile with and without no_lbr
1010

1111
#--- a.fdata
1212
no_lbr

0 commit comments

Comments
 (0)