[llvm] [SPARC] Preserve liveins after leaf register remapping (PR #213359)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 2 14:02:04 PDT 2026
================
@@ -259,53 +264,57 @@ SparcFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI,
return true;
}
-bool SparcFrameLowering::isLeafProc(MachineFunction &MF) const
-{
-
- MachineRegisterInfo &MRI = MF.getRegInfo();
- MachineFrameInfo &MFI = MF.getFrameInfo();
+bool SparcFrameLowering::isLeafProc(MachineFunction &MF) const {
+ if (MF.getFrameInfo().hasCalls() || hasFP(MF) || MF.hasInlineAsm())
+ return false;
- return !(MFI.hasCalls() // has calls
- || MRI.isPhysRegUsed(SP::L0) // Too many registers needed
- || MRI.isPhysRegUsed(SP::O6) // %sp is used
- || hasFP(MF) // need %fp
- || MF.hasInlineAsm()); // has inline assembly
+ const MachineRegisterInfo &MRI = MF.getRegInfo();
+ for (unsigned Reg = SP::L0; Reg <= SP::L7; ++Reg)
----------------
arsenm wrote:
I think the flow is closer to correct now, though checking isPhysRegUsed in a function called by getReservedRegs is still concerning. Is there a more direct property you can check that implies these registers would be used, rather than checking if they happened to appear during selection?
https://github.com/llvm/llvm-project/pull/213359
More information about the llvm-commits
mailing list