Skip to content

Commit c2dc034

Browse files
Merge branch 'main' into ci-container-non-root
2 parents aa85add + 1751914 commit c2dc034

File tree

2,876 files changed

+17299
-14828
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,876 files changed

+17299
-14828
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

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,6 @@ b6262880b34629e9d7a72b5a42f315a3c9ed8139
9494
39c7dc7207e76e72da21cf4fedda21b5311bf62d
9595
e80bc777749331e9519575f416c342f7626dd14d
9696
7e5cd8f1b6c5263ed5e2cc03d60c8779a8d3e9f7
97+
98+
# NFC: clang-format test_demangle.pass.cpp but keep test "lines"
99+
d33bf2e9df578ff7e44fd22504d6ad5a122b7ee6

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C .
4141
FROM base
4242

4343
COPY --from=stage1-toolchain $LLVM_SYSROOT $LLVM_SYSROOT
44-
44+
4545
# Need to install curl for hendrikmuhs/ccache-action
4646
# Need nodejs for some of the GitHub actions.
4747
# Need perl-modules for clang analyzer tests.
4848
# Need git for SPIRV-Tools tests.
4949
RUN apt-get update && \
50-
apt-get install -y \
50+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
5151
binutils \
5252
cmake \
5353
curl \
@@ -56,7 +56,15 @@ RUN apt-get update && \
5656
ninja-build \
5757
nodejs \
5858
perl-modules \
59-
python3-psutil
59+
python3-psutil \
60+
61+
# These are needed by the premerge pipeline. Pip is used to install
62+
# dependent python packages and ccache is used for build caching. File and
63+
# tzdata are used for tests.
64+
python3-pip \
65+
ccache \
66+
file \
67+
tzdata
6068

6169
ENV LLVM_SYSROOT=$LLVM_SYSROOT
6270
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}

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/dwarf5-debug-names-gnu-push-tls-address.s

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -27,71 +27,35 @@
2727
## x = 10;
2828
## return x;
2929
## }
30-
.text
3130
.file "main.cpp"
3231
.file 0 "gnu_tls_push" "main.cpp" md5 0x551db97d5e23dc6a81abdc5ade4d9d71
33-
.globl main # -- Begin function main
34-
.p2align 4, 0x90
32+
.globl main
3533
.type main,@function
36-
main: # @main
34+
main:
3735
.Lfunc_begin0:
38-
.loc 0 2 0 # main.cpp:2:0
39-
.cfi_startproc
40-
# %bb.0: # %entry
41-
pushq %rbp
42-
.cfi_def_cfa_offset 16
43-
.cfi_offset %rbp, -16
44-
movq %rsp, %rbp
45-
.cfi_def_cfa_register %rbp
46-
movl $0, -4(%rbp)
47-
.Ltmp0:
48-
.loc 0 3 3 prologue_end # main.cpp:3:3
49-
movq %fs:0, %rax
50-
leaq x@TPOFF(%rax), %rax
51-
.loc 0 3 5 is_stmt 0 # main.cpp:3:5
52-
movl $10, (%rax)
53-
.loc 0 4 10 is_stmt 1 # main.cpp:4:10
54-
movq %fs:0, %rax
55-
leaq x@TPOFF(%rax), %rax
56-
movl (%rax), %eax
57-
.loc 0 4 3 epilogue_begin is_stmt 0 # main.cpp:4:3
58-
popq %rbp
59-
.cfi_def_cfa %rsp, 8
36+
.loc 0 2 0
37+
.loc 0 3 3 prologue_end
38+
.loc 0 3 5 is_stmt 0
39+
.loc 0 4 10 is_stmt 1
40+
.loc 0 4 3 epilogue_begin is_stmt 0
6041
retq
61-
.Ltmp1:
6242
.Lfunc_end0:
6343
.size main, .Lfunc_end0-main
64-
.cfi_endproc
65-
# -- End function
66-
.section .text._ZTW1x,"axG",@progbits,_ZTW1x,comdat
67-
.hidden _ZTW1x # -- Begin function _ZTW1x
44+
45+
.hidden _ZTW1x
6846
.weak _ZTW1x
69-
.p2align 4, 0x90
7047
.type _ZTW1x,@function
71-
_ZTW1x: # @_ZTW1x
48+
_ZTW1x:
7249
.Lfunc_begin1:
73-
.cfi_startproc
74-
# %bb.0:
75-
pushq %rbp
76-
.cfi_def_cfa_offset 16
77-
.cfi_offset %rbp, -16
78-
movq %rsp, %rbp
79-
.cfi_def_cfa_register %rbp
80-
movq %fs:0, %rax
81-
leaq x@TPOFF(%rax), %rax
82-
popq %rbp
83-
.cfi_def_cfa %rsp, 8
8450
retq
8551
.Lfunc_end1:
8652
.size _ZTW1x, .Lfunc_end1-_ZTW1x
87-
.cfi_endproc
88-
# -- End function
89-
.type x,@object # @x
53+
54+
.type x,@object
9055
.section .tbss,"awT",@nobits
9156
.globl x
92-
.p2align 2, 0x0
9357
x:
94-
.long 0 # 0x0
58+
.long 0
9559
.size x, 4
9660

9761
.section .debug_abbrev,"",@progbits

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

0 commit comments

Comments
 (0)