[llvm] [AArch64][SVE] Avoid extra pop of "FixedObject" with FPAfterSVECalleeSaves (PR #156452)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 2 05:54:48 PDT 2025
================
@@ -2587,15 +2595,22 @@ void AArch64FrameLowering::emitEpilogue(MachineFunction &MF,
// may clobber), convert it to a post-index ldp.
if (OffsetOp.getImm() == 0 && AfterCSRPopSize >= 0) {
convertCalleeSaveRestoreToSPPrePostIncDec(
- MBB, Pop, DL, TII, PrologueSaveSize, NeedsWinCFI, &HasWinCFI, EmitCFI,
- MachineInstr::FrameDestroy, PrologueSaveSize);
+ MBB, Pop, DL, TII, ProloguePopSize, NeedsWinCFI, &HasWinCFI, EmitCFI,
+ MachineInstr::FrameDestroy, ProloguePopSize);
+ } else if (FPAfterSVECalleeSaves) {
+ // If not, and FPAfterSVECalleeSaves is enabled, deallocate callee-save
+ // non-SVE registers to move the stack pointer to the start of the SVE
+ // area.
+ emitFrameOffset(MBB, std::next(Pop), DL, AArch64::SP, AArch64::SP,
+ StackOffset::getFixed(ProloguePopSize), TII,
+ MachineInstr::FrameDestroy, false, NeedsWinCFI,
+ &HasWinCFI);
----------------
MacDue wrote:
I've been unable to come up with a reasonable test for this case. With `!FPAfterSVECalleeSaves` we only get here if:
- We have hazard padding (not applicable)
- Or use some somewhat niche `swiftcc` or `tailcc` functionality, which I'm not sure works with SVE.
I wonder if it'd be okay to just do `if (FPAfterSVECalleeSaves) reportFatalInternalError(...)` instead?
https://github.com/llvm/llvm-project/pull/156452
More information about the llvm-commits
mailing list