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

Visoiu Mistrih Francis via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 08:55:46 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))
----------------
francisvm wrote:

Added test with `-mattr=+save-restore`

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


More information about the llvm-commits mailing list