[llvm] [AArch64] Use a frame record for non-leaf outlined functions on MachO (PR #213711)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 08:22:14 PDT 2026
kyulee-com wrote:
@nocchijiang Thanks for the detailed comments. I added the flag you suggested, `-aarch64-outliner-compact-unwind-frame`, hidden and defaulting to on.
1. FP availability. You are right, and I gated the frame record on `Candidate::isAvailableInsideSeq(AArch64::FP, TRI)` as you suggested. `buildOutlinedFrame` no longer has the candidates, so it repeats the same `LiveRegUnits` query over the outlined block, which keeps the estimate and the emitted code in agreement. I added a test to cover it.
2. Cost model. The +4 is now charged only when the frame record is selected, for the extra `mov x29, sp`, not unwind metadata. Modeling the unwind info itself is harder. ICF folds outlined functions and their entries, and both `__eh_frame` and `__unwind_info` are structured, so one more entry does not cost a fixed number of bytes. I tried a few tuning knobs and did not find a clear direction, so I have left it out here as before.
3. The extra `mov x29, sp`. I do not think runtime cost is the concern, since it is one cheap ALU op and outlining can be kept off hot code anyway. With compact unwind, ICF can fold these functions in LLD today, saving `__text` size and potentially improving page faults at start-up. It should also make unwinding cheaper, potentially improving performance for backtraces and profilers.
https://github.com/llvm/llvm-project/pull/213711
More information about the llvm-commits
mailing list