================
@@ -1456,15 +1433,12 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction 
&MF,
   if (NeedsDwarfCFI && hasFP(MF))
     CFIBuilder.buildDefCFA(SPReg, RealStackSize);
 
-  // With a frame pointer, restore the SiFive CLIC CSRs through X5.
-  if (hasFP(MF))
-    emitSiFiveCLICPreemptibleRestores(MF, MBB, FirstScalarCSRRestoreInsn, DL);
-
   // Skip to after the restores of scalar callee-saved registers
   // FIXME: assumes exactly one instruction is used to restore each
   // callee-saved register.
   MBBI = std::next(FirstScalarCSRRestoreInsn,
-                   getUnmanagedCSI(MF, CSI, PreferAscendingLS).size());
+                   getScalarSpillCSI(MF, CSI, PreferAscendingLS).size());
+  emitSiFiveCLICPreemptibleRestores(MF, MBB, MBBI, DL);
   CFIBuilder.setInsertPoint(MBBI);
----------------
zeyi2 wrote:

Fixed, thanks!

https://github.com/llvm/llvm-project/pull/221318
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to