llvm-project
3d6155d7 - [RISCV] Don't restore SP from FP in the epilogue when SP never moved (#239761)

Commit
7 days ago
[RISCV] Don't restore SP from FP in the epilogue when SP never moved (#239761) With a frame pointer and the V extension enabled, hasReservedCallFrame() is false for every function, because hasRVVFrameObject() answers from the subtarget rather than from the frame. emitEpilogue() then restores SP from FP in every frame-pointer function, including the ones with no outgoing stack arguments, no RVV stack objects and no variable-sized objects, where SP still holds the value the prologue gave it. Only restore SP from FP for an unreserved call frame when a call passes arguments on the stack, the case the restore was added for, or when it replaces the multi-instruction undo of an RVV stack area or a split SP adjustment. In a distribution libLLVM.so built for RVA23 with frame pointers, this removes 133,758 of 140,895 such restores, about 535 KB of text. Found-with riscvlint. Assisted-by: Claude Code (Claude Fable 5.1)
Author
Parents
Loading