[llvm] [MachineOutliner] Don't outline ADRP pair to avoid incorrect ICF (PR #160232)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 23:52:02 PDT 2025


lenary wrote:

I have been wondering on the RISC-V side if we can add back our ADRP-like instruction to the outlined segment if we find we have only outlined the instruction with the lo operand. This would potentially add overhead to sequences where only the lo instruction has been outlined, and might cause redundant ADRP-likes, but I think it might allow more outlining? I think this should be doable in `buildOutlinedFrame`, but additional work would also have to be done in `getOutliningCandidateInfo` to correctly set the `FrameOverhead`.

I don't know how this approach would cope if the outliner tries to only outline the ADRP-like, rather than the lo instruction. You'd presumably want to replicate the ADRPs from inside the outlined part to immediately after the call to the outlined sequence? That sounds like it might be too much overhead, but the cost model might catch that.

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


More information about the llvm-commits mailing list