[llvm] [BOLT][AArch64] Add support for compact code model (PR #112110)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 07:22:14 PST 2024


paschalis-mpeis wrote:

> This is quite possible when for some functions fragments are separated by less than 1MB (e.g. hot code is less or close to 1MB). In such case, some trampolines to cold code introduced by relaxLocalBranches() will be unnecessary. If, however, that's not the case, I would like to take a look at your test case and see if we can improve the pass.

Haven't checked if that was the case (ie, fragments <1MB). For now just sharing what was done:
- Compared to trunk it was around 4% less.
- Used [this binary](https://github.com/llvm/llvm-project/issues/99848#issue-2422296515) that I got using the provided [dockerscript](https://gist.githubusercontent.com/paschalis-mpeis/9eb878f73e18fb9d3f996ae7c59d4792/raw/5baef8dc9acdd1cc74800aa5d3542993c926129d/Dockerfile).






| Version                                                           | Hot Size | Cold Size | Hot Size Diff | Cold Size Diff | Comments     |
| ----------------------------------------------------------------- | :--------: |  ---------: | :-------------: | :--------------: | ------------ |
| Without [#96609](https://github.com/llvm/llvm-project/pull/96609) | 735Ki    | 908Ki     | -             | -              | **baseline** |
| With [#96609](https://github.com/llvm/llvm-project/pull/96609)    | 628Ki    | 803Ki     | -17%          | -13%           |              |
| compact-mode                                                      | 652Ki    | 805Ki     | -12%          | -12%           |              |


This [comment](https://github.com/llvm/llvm-project/issues/99848#issuecomment-2454647053) has some 'Stub Insertion Stats' (hot/cold/shared) for `LongJmp` if more details are needed (at section 3).

https://github.com/llvm/llvm-project/pull/112110


More information about the llvm-commits mailing list