[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


================
@@ -1088,7 +1092,8 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction &MF,
   // Skip to before the restores of scalar callee-saved registers
   // FIXME: assumes exactly one instruction is used to restore each
   // callee-saved register.
-  auto LastFrameDestroy = std::prev(MBBI, getUnmanagedCSI(MF, CSI).size());
+  auto FirstScalarCSRRestoreInsn =
+      std::next(MBBI, getRVVCalleeSavedInfo(MF, CSI).size());
----------------
lenary wrote:

I don't fully understand why this iterator is now different, and how this behaviour is better. Can you explain a bit more how you know this is correct?

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


More information about the llvm-commits mailing list