[all-commits] [llvm/llvm-project] cb9bac: [AArch64][BOLT] Ensure tentative code layout for c...

Paschalis Mpeis via All-commits all-commits at lists.llvm.org
Thu Oct 17 00:59:26 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cb9bacf57d5c58eba28a76fd07ea2d4f9a0da847
      https://github.com/llvm/llvm-project/commit/cb9bacf57d5c58eba28a76fd07ea2d4f9a0da847
  Author: Paschalis Mpeis <paschalis.mpeis at arm.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M bolt/lib/Passes/LongJmp.cpp
    A bolt/test/AArch64/split-funcs-lite.s

  Log Message:
  -----------
  [AArch64][BOLT] Ensure tentative code layout for cold BBs runs. (#96609)

When split functions is used, BOLT may skip tentative code layout
estimation in some cases, like:
- when there is no profile data for some blocks (ie cold blocks)
- when there are cold functions in lite mode
- when skip functions is used
     
However, when rewriting the binary we still need to compute PC-relative
distances between hot and cold basic blocks. Without cold layout
estimation, BOLT uses '0x0' as the address of the first cold block,
leading to incorrect estimations of any PC-relative addresses.
 
This affects large binaries as the relaxStub method expands more
branches than necessary using the short-jump sequence, at it wrongly
believes it has exceeded the branch distance boundary.
 
This increases code size with both a larger and slower sequence;
however,
performance regression is expected to be minimal since this only affects
any called cold code.
 
Example of such an unnecessary relaxation:
from:
```armasm
b       .Ltmp1234
```
 
to:
```armasm
adrp    x16, .Ltmp1234
add     x16, x16, :lo12:.Ltmp1234
br      x16
```



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