[llvm] [BOLT][AArch64] Relax calls and branches with fragment clusters (PR #215825)
Alexandros Lamprineas via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 07:15:52 PDT 2026
labrinea wrote:
@rafaelauler I have added the thunk estimation pass as suggested. The estimator aims to model a worst-case scenario by assuming the selected thunks are necessary, without performing range checks, while accounting for expected reuse. It processes references in the same order as relaxation to approximate where thunks will actually be created. This adds an extra pass over the collected references and some maintenance cost, since the estimation and relaxation logic need to stay aligned.
I found that in my Chromium experiment, the inserted thunk bytes are small compared with the 4 MiB safety margin:
| Layout | Estimated thunk bytes (total) | Actual thunk bytes (total) |
|---|---:|---:|
| Normal | 171.7 KiB | 94.3 KiB |
| Hot functions at end | 192.9 KiB | 112.8 KiB |
The largest per-cluster estimate is 104.6 KiB, approximately 2.6% of the 4 MiB margin. For this workload, the estimated thunk growth therefore accounts for only a small fraction of the existing safety margin. However, these runs have only two clusters, so they do not exercise multi-hop branch chains. The hot-at-end run does create two branch thunks, with one reuse. In larger binaries with more clusters and longer chains, accounting for accumulated thunk bytes may be more valuable.
https://github.com/llvm/llvm-project/pull/215825
More information about the llvm-commits
mailing list