[llvm] [BOLT][AArch64] Add support for compact code model (PR #112110)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 09:34:46 PDT 2024
https://github.com/smithp35 commented:
> @smithp35 would you also be able to have a look at this?
I've taken a look. I'm primarily a linker person rather than a BOLT person so I'll need someone more familiar with BOLT to comment on the details of the code structure. I could follow what the code was trying to do and I couldn't spot anything obviously incorrect.
My understanding is that this local relaxation is for conditional branch targets which are normally local to the function, but if BOLT splits a function then they can get out of range.
One possible extension so that this could be used without needing a compact mode, is to write the stub as ADRP, ADD, BR if the destination were greater than 128MB away. LLD will try and use "short" unconditional branches at first, but if these get knocked out of range they are rewritten as "long" sequences. This can add more passes as more instructions are added. We also don't change a long stub back to a short one to make sure we converge.
I did think that it could be worth inserting the trampoline later than the end of the block to maximize the chance it can be reused, but that might end up losing performance so I can see why it is created as close to the source as possible.
https://github.com/llvm/llvm-project/pull/112110
More information about the llvm-commits
mailing list