[llvm] [RISCV] Remove explicitly adding spilled registers as liveins. (PR #180483)

Jim Lin via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 00:23:33 PST 2026


https://github.com/tclin914 created https://github.com/llvm/llvm-project/pull/180483

We didn't explicitly add spilled registers as liveins for CM_PUSH as well. The liveins of the basic block will be analyzed by later optimization pass.

>From 1e7682f90fdeed6b04b342d282cb9c7d601bda61 Mon Sep 17 00:00:00 2001
From: Jim Lin <jim at andestech.com>
Date: Mon, 9 Feb 2026 13:04:59 +0800
Subject: [PATCH] [RISCV] Remove manaully adding spilled registers as liveins.

We didn't manaully add spilled registers as liveins for CM_PUSH as well.
The liveins of the basic block will be analyzed by later optimization pass.
---
 llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index 24b83026bf824..7212ed39eb70e 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -2153,12 +2153,9 @@ bool RISCVFrameLowering::spillCalleeSavedRegisters(
             .addExternalSymbol(SpillLibCall, RISCVII::MO_CALL)
             .setMIFlag(MachineInstr::FrameSetup);
 
-    for (auto &CS : CSI) {
-      // Add registers spilled as implicit used.
+    // Add registers spilled as implicit used.
+    for (auto &CS : CSI)
       NewMI.addUse(CS.getReg(), RegState::Implicit);
-      // Add registers spilled in libcall as liveins.
-      MBB.addLiveIn(CS.getReg());
-    }
   }
 
   // Manually spill values not spilled by libcall & Push/Pop.



More information about the llvm-commits mailing list