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

Venkata Ramanaiah Nalamothu via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 07:03:09 PST 2025


================
@@ -1000,20 +1005,20 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction &MF,
     // If RestoreSPFromFP the stack pointer will be restored using the frame
     // pointer value.
     if (!RestoreSPFromFP)
-      RI->adjustReg(MBB, LastFrameDestroy, DL, SPReg, SPReg,
+      RI->adjustReg(MBB, LastScalarFrameDestroy, DL, SPReg, SPReg,
----------------
RamNalamothu wrote:

The logic here is trying to find the first scalar callee-saved register restore instruction using _FrameDestroy_ flag.

Before this patch, the _FrameDestroy_ flag was being added only to _CM.POP/libcall restore instruction_ and the _LastFrameDestroy_ would always end up with those, the only callee-saved register restore instructions with _FrameDestroy_ flag.

But this patch adds _FrameDestroy_ to all callee saved register restore instructions and hence I thought changing the name to what it represents might make sense. However, the name should have been _FirstScalarFrameDestroy_ and not _LastScalarFrameDestroy_. I will fix that.

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


More information about the llvm-commits mailing list