[llvm] [RISC-V] Fix incorrect epilogue_begin (PR #120623)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 10:31:00 PST 2025


================
@@ -820,6 +819,12 @@ void RISCVFrameLowering::emitPrologue(MachineFunction &MF,
 
   const auto &CSI = MFI.getCalleeSavedInfo();
 
+  // Skip to before the spills of scalar callee-saved registers
+  // FIXME: assumes exactly one instruction is used to restore each
+  // callee-saved register.
+  MBBI = std::prev(MBBI, getRVVCalleeSavedInfo(MF, CSI).size() +
+                             getUnmanagedCSI(MF, CSI).size());
----------------
lenary wrote:

Why can't you do something like `MBBI = FirstFrameSetup;` here, or something similar where you save the value of MBBI from before all the frame setup is inserted?

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


More information about the llvm-commits mailing list