[llvm] [BOLT][AArch64] Add call relaxation pass (PR #173952)

Rafael Auler via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 16:47:39 PDT 2026


rafaelauler wrote:

> Hi @rafaelauler and @aaupov. My reading of this patch is that calls within the same cluster are assumed directly reachable. Calls outside may need thunks. How do we deal with functions which belong to the same cluster, but are split across different sections? Do we support such scenarios:
> 
> * hot/main fragment caller -> cold/warm fragment callee
> * cold/warm fragment caller -> hot/main fragment callee

Cross-section calls in the same cluster are always reachable because there is a hidden assumption for this pass that hot code is always less than 125M (fits in the first cluster). Because of this, the way it behaves is that all hot code and split fragments of hot functions belong to the first cluster. So for a 3-cluster scenario, c0, c1, c2, a hot fragment of a function in c2 will never be emitted in cluster c0's address region simply because there are no hot functions in c2, all of them are in c0. But yes, the way the emitter works, that _could_ happen and will break if you have hot functions in other clusters.

I can push forward this pass in open-source later if Maksim doesn't want to spend time on this. I would just add some messages to make explicit when this is safe (such as the requirement that hot code can't exceed a cluster-size). But we can just merge this and then add the follow-up safety guardrails in upcoming PRs.

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


More information about the llvm-commits mailing list