[llvm] [AArch64] Ensure the LR is preserved if we must call __arm_get_current_vg (PR #145760)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 25 12:10:56 PDT 2025
================
@@ -3955,6 +3955,10 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF,
// Save number of saved regs, so we can easily update CSStackSize later.
unsigned NumSavedRegs = SavedRegs.count();
+ // If we must call __arm_get_current_vg in the prologue preserve the LR.
+ if (requiresSaveVG(MF) && !Subtarget.hasSVE())
+ SavedRegs.set(AArch64::LR);
----------------
MacDue wrote:
Yes, as later it's used to update the `CSStackSize` to include the additional saves:
```
// Adding the size of additional 64bit GPR saves.
CSStackSize += 8 * (SavedRegs.count() - NumSavedRegs);
```
https://github.com/llvm/llvm-project/pull/145760
More information about the llvm-commits
mailing list