[llvm] [AArch64][SME] Fix restoring callee-saves from FP with hazard padding (PR #143371)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 08:02:47 PDT 2025
================
@@ -2539,13 +2554,35 @@ void AArch64FrameLowering::emitEpilogue(MachineFunction &MF,
// restore the stack pointer from the frame pointer prior to SVE CSR
// restoration.
if (AFI->isStackRealigned() || MFI.hasVarSizedObjects()) {
- if (int64_t CalleeSavedSize = AFI->getSVECalleeSavedStackSize()) {
+ if (int64_t SVECalleeSavedSize = AFI->getSVECalleeSavedStackSize()) {
// Set SP to start of SVE callee-save area from which they can
- // be reloaded. The code below will deallocate the stack space
- // space by moving FP -> SP.
- emitFrameOffset(MBB, RestoreBegin, DL, AArch64::SP, AArch64::FP,
- StackOffset::getScalable(-CalleeSavedSize), TII,
- MachineInstr::FrameDestroy);
+ // be reloaded.
+ const AArch64RegisterInfo *RegInfo = Subtarget.getRegisterInfo();
+ if (!AFI->isStackRealigned() && RegInfo->hasBasePointer(MF)) {
----------------
MacDue wrote:
I've reworked this so the selection of the base pointer is a seperate step, which I think makes things a little easier to follow. This also made me realize I'd missed the case there there's SVE locals and we're restoring from the BP (which is now fixed).
https://github.com/llvm/llvm-project/pull/143371
More information about the llvm-commits
mailing list