[all-commits] [llvm/llvm-project] 08dd00: BOLT may never run the tentative code layout for c...
Paschalis Mpeis via All-commits
all-commits at lists.llvm.org
Tue Oct 1 04:16:32 PDT 2024
Branch: refs/heads/users/paschalis-mpeis/lite-split-functions-cold-layout
Home: https://github.com/llvm/llvm-project
Commit: 08dd00fd7e25114e456acaa650d56d4202303518
https://github.com/llvm/llvm-project/commit/08dd00fd7e25114e456acaa650d56d4202303518
Author: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
Date: 2024-10-01 (Tue, 01 Oct 2024)
Changed paths:
M bolt/lib/Passes/LongJmp.cpp
A bolt/test/AArch64/split-funcs-lite.test
Log Message:
-----------
BOLT may never run the tentative code layout for cold BBs.
However, it might later require the addresses of cold BBs to compute
PC-relative jumps between hot and cold fragments of a function. Since
the addresses were never estimated, it uses 0x0 for cold BBs, resulting
in incorrect estimated addresses for any instructions within them.
As a result, LongJump often expands a branch that would otherwise fit in
a single instruction into a short jump.
For example, `relaxStub` might expand from:
```armasm
b .Ltmp1234
```
to:
```armasm
adrp x16, .Ltmp1234
add x16, x16, :lo12:.Ltmp1234
br x16
```
While this expansion is not wrong, it is unnecessary. Moreover, in some
large binaries this expansion has lead to runtime crashes. This should
be investigated further, as such expansions should not cause crashes.
Commit: 31dd42ab65e14670cb89713c497fcf2b4cf098b8
https://github.com/llvm/llvm-project/commit/31dd42ab65e14670cb89713c497fcf2b4cf098b8
Author: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
Date: 2024-10-01 (Tue, 01 Oct 2024)
Changed paths:
M bolt/lib/Passes/LongJmp.cpp
M bolt/test/AArch64/split-funcs-lite.test
Log Message:
-----------
[AArch64][BOLT] Ensure tentative code layout for cold BBs runs.
When BOLT is not processing all functions (e.g., when lite mode is
enabled or when multiple functions are ignored via the 'skip-funcs' flag),
we might skip the tentative code layout estimation for cold basic blocks.
However, due to the `-split-functions`` flag, we still need to compute
PC-relative distances between hot and cold basic blocks.
In such cases, BOLT will use '0x0' as the first address of the basic
block, leading to incorrect estimations of the necessary PC-relative
addresses. Consequently, the relaxStub method expands all those branches
to the short-jump sequence unnecessarily.
Such an unnecessary expansion by `relaxStub` is from:
```armasm
b .Ltmp1234
```
to:
```armasm
adrp x16, .Ltmp1234
add x16, x16, :lo12:.Ltmp1234
br x16
```
Commit: 690d4857e8d99fe4b9ada1e64de94574f8869a40
https://github.com/llvm/llvm-project/commit/690d4857e8d99fe4b9ada1e64de94574f8869a40
Author: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
Date: 2024-10-01 (Tue, 01 Oct 2024)
Changed paths:
M bolt/lib/Passes/LongJmp.cpp
M bolt/test/AArch64/split-funcs-lite.test
Log Message:
-----------
Addressing reviewers.
Compare: https://github.com/llvm/llvm-project/compare/7cd7950ee082...690d4857e8d9
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list