[llvm] [SPARC] Preserve liveins after leaf register remapping (PR #213359)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 8 07:11:52 PDT 2026


================
@@ -259,53 +264,53 @@ SparcFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI,
   return true;
 }
 
-bool SparcFrameLowering::isLeafProc(MachineFunction &MF) const
-{
-
-  MachineRegisterInfo &MRI = MF.getRegInfo();
-  MachineFrameInfo    &MFI = MF.getFrameInfo();
-
-  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
+bool SparcFrameLowering::isLeafProc(MachineFunction &MF,
+                                    bool UsesLocalRegister) const {
+  if (MF.getFrameInfo().hasCalls() || hasFP(MF) || MF.hasInlineAsm() ||
----------------
koachan wrote:

Where is the %sp usage check gone?
IIRC it's unsafe to do leaf procedure optimization on functions using it in its body.

https://github.com/llvm/llvm-project/pull/213359


More information about the llvm-commits mailing list