[llvm] [AArch64] Ensure the LR is preserved if we must call __arm_get_current_vg (PR #145760)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 25 12:54:47 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);
----------------
efriedma-quic wrote:
Oh, hmm, I guess that works.
Maybe we should move the declaration of NumSavedRegs immediately after the `for (unsigned Reg : SavedRegs.set_bits()) {` loop, to make the connection more clear?
https://github.com/llvm/llvm-project/pull/145760
More information about the llvm-commits
mailing list