[llvm] [BOLT][AArch64] Relax calls and branches with fragment clusters (PR #215825)

Adam Bzowski via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 02:05:29 PDT 2026


adam-bzowski-arm wrote:

> Maybe the size estimation can be improved?

I think this is exactly where the full layout calculation can help. It calculates the layout exactly, including sections ordering, alignment, padding, constant islands, command line options, hugify, old text, hot functions at the end, etc. Consequently, a hot and cold fragment of the same function receive their actual distinct positions, to a single byte, instead of approximations.

This seems substantially more robust than reducing MaxClusterSize: a larger safety margin only makes estimation errors less likely, while the full layout addresses their causes. It would also let us make range checks without inserting thunks unconditionally and before the crash at MC emission / JIT linking. I have already integrated this layout into the experimental relaxation path, and it works for my Chromium builds well. The full layout increased LongJmp runtime by approximately 5% overall, with individual overheads ranging from 2.6% to 6.7%.

Therefore, I would suggest merging this PR as the foundation, then following up by integrating the full layout calculation. I would create a draft PR to show what I mean, if you think this can be useful. 

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


More information about the llvm-commits mailing list