[llvm] [BOLT][AArch64] Relax calls and branches with fragment clusters (PR #215825)
Rafael Auler via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 18:12:54 PDT 2026
rafaelauler wrote:
> @rafaelauler Adam’s example makes me reconsider how EstimatedThunkBytes is used in isWithinClusterRange. MaxClusterSize is already below Branch26 reach to reserve room for thunk growth and final emission padding. Adding estimated thunk bytes while comparing against MaxClusterSize deducts them from the cluster limit instead of that reserved room. For a boundary thunk, the base distance can equal a full cluster, so I think the conservative hop check should be `Distance <= MaxClusterSize`. We should separately ensure that thunk growth and output padding fit within the remaining Branch26 reach. Simply changing the right-hand side to 128 MiB would not account for final emission gaps.
Makes sense. So let's remove EstimatedThunkBytes and just add a check at the end ensuring the thunk growth and outputting is not overflowing our reserved space created by MaxClusterSize, like you said. Something like:
if (TotalThunkBytes + BC.AlignText > LongestJumpSpan - opts::MaxClusterSize)
Should be correct to trigger an output warning. Then if JITLink fails, at least we will know it is because MaxClusterSize is not reserving enough head room.
https://github.com/llvm/llvm-project/pull/215825
More information about the llvm-commits
mailing list