[llvm] [BOLT][AArch64] Prefer non reloc layout for short branches beyond fragment. (PR #174546)
Gergely Bálint via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 6 01:30:49 PST 2026
https://github.com/bgergely0 commented:
Thanks for the patch @labrinea!
Left a few nits, but overall I'm not sure if this is serving its purpose well (or I'm misunderstanding the purpose). Can you check my reasoning below?
In the LongJmp pass, if a branch or branch-and-link would go out of range, BOLT adds "stubs" between them. Based on the layout, we then "relax" these stubs, meaning we change simple "branch stubs" to ones with more instructions and hence more range. See longer range stubs here:
https://github.com/llvm/llvm-project/blob/main/bolt/lib/Passes/LongJmp.cpp#L40-L54
I think the solution to conditional branches going out of range should be the same as other branches/calls going out of range. Otherwise we change the layout requirements in a lot of cases. This would surely impact performance uplift of BOLTing. Ideally such changes should have benchmark numbers to show the effect of the patch.
If this is viewed as a quick bug fix, then changing layout may be acceptable, but I don't see a test with a case that crashed before the patch.
Did you see crashes in BOLT or the created binary without this patch?
https://github.com/llvm/llvm-project/pull/174546
More information about the llvm-commits
mailing list