[llvm-branch-commits] [llvm] [amdgpu-cfi: 7/9]: [AMDGPU] Implement CFI for CSR spills (PR #183150)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Apr 23 06:52:00 PDT 2026


================
@@ -2221,17 +2221,88 @@ bool SIFrameLowering::allocateScavengingFrameIndexesNearIncomingSP(
   return true;
 }
 
+/// If we a tracking liveness, return the set of all roots of live-in registers
+/// to @p MBB, otherwise return @c std::nullopt.
+///
+/// Intended to avoid using the expensive @c MCRegAliasIterator when deciding
+/// if a register to be spilled is already live-in (see @c isAnyRootLiveIn).
+static std::optional<SparseBitVector<>>
+buildLiveInRoots(const MachineBasicBlock &MBB, const TargetRegisterInfo *TRI) {
+  const MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo();
+  if (!MRI.tracksLiveness())
----------------
arsenm wrote:

Avoid calling this in the first place, instead of returning optional in this case? 

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


More information about the llvm-branch-commits mailing list