[llvm] [BOLT][AArch64] Support block reordering beyond 1KB for FEAT_CMPBR. (PR #185443)
Alexandros Lamprineas via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 11 04:47:06 PDT 2026
labrinea wrote:
Hey Gergely, thanks for looking at my patch. The users of `ShortestJumpSpan` are in two places, [here](https://github.com/llvm/llvm-project/blob/main/bolt/lib/Passes/LongJmp.cpp#L659) and [here](https://github.com/llvm/llvm-project/blob/main/bolt/lib/Passes/LongJmp.cpp#L878). We are essentially checking whether the size of a code fragment is within the range of the shortest branch instruction, in which case relaxation is not needed and therefore we exit the loop early. For binaries without cmpbr, if `1KB < fragmentSize < 32KB` before my change we would immediately exit the loop, but now we may have to iterate longer eventually arriving at the same layout decisions.
> Hi Alexandros,
>
> I quickly skimmed through related code, but not sure of the answer: when decreasing `ShortestJumpSpan`, does this change affect binaries without cmpbr?
No, it shouldn't
> Or the function will just do more work, but arrive at the same layout?
Yes, that's my understanding
> In other words, does this stricter requirement for cmpbr change BOLT's ability to optimize current workloads, and to what extent?
I wouldn't say it is a stricter requirement, but rather the contrary. We consider cases we disregarded before.
https://github.com/llvm/llvm-project/pull/185443
More information about the llvm-commits
mailing list