[llvm] [RISCV] Remove CalleeSavedInfo for Zcmp/save-restore-libcalls registers (PR #79535)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 23:27:05 PST 2024


================
@@ -1252,6 +1252,30 @@ void RISCVFrameLowering::processFunctionBeforeFrameFinalized(
   RVFI->setCalleeSavedStackSize(Size);
 }
 
+void RISCVFrameLowering::processFunctionBeforeFrameIndicesReplaced(
+    MachineFunction &MF, RegScavenger *RS) const {
+  // Remove CalleeSavedInfo for registers saved by Zcmp or save/restore
+  // libcalls.
+  MachineFrameInfo &MFI = MF.getFrameInfo();
+  const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
+  const auto *RVFI = MF.getInfo<RISCVMachineFunctionInfo>();
+  if (!RVFI->isPushable(MF) && !RVFI->useSaveRestoreLibCalls(MF))
----------------
wangpc-pp wrote:

We need test coverage for `useSaveRestoreLibCalls`.

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


More information about the llvm-commits mailing list