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

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 11:24:00 PDT 2024


maksfb wrote:

> I'm not sure how LongJump might evolve in the future from code design point of view. eg, if JITLink does relaxation for >128MB, then we may have 'Tentative Mode' (the original LongJmp pass) and 'Non-Tentative/Local Mode' (the evolution of compact-mode).

Thanks again for the code review, Paschalis. We might leave the original LongJmp for some time, but eventually I plan to replace it with JITLink or any other pass that doesn't rely on code layout assumptions.

> Re code size decreases:
> 
> > I don't think we have such expectation. Just something I've noticed.
> 
> Okay thanks. Quickly comparing sizes of a single binary (~55MB of text) in compact mode versus the updated LongJmp (#96609):
> 
> * cold section had the same size
> * LongJmp's hot section was smaller, I guess due to hot stub sharing

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.

I just checked the build with #96609 for Clang. Hot code is ~6MB and `--compact-code-model` is slightly more efficient.

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


More information about the llvm-commits mailing list