[llvm-branch-commits] [llvm] [amdgpu-cfi: 8/9]: [AMDGPU] Implement -amdgpu-spill-cfi-saved-regs (PR #183149)

Scott Linder via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 6 13:00:31 PST 2026


================
@@ -670,12 +670,21 @@ void SIFrameLowering::emitEntryFunctionFlatScratchInit(
 }
 
 // Note SGPRSpill stack IDs should only be used for SGPR spilling to VGPRs, not
-// memory. They should have been removed by now.
-static bool allStackObjectsAreDead(const MachineFrameInfo &MFI) {
-  for (int I = MFI.getObjectIndexBegin(), E = MFI.getObjectIndexEnd();
-       I != E; ++I) {
-    if (!MFI.isDeadObjectIndex(I))
+// memory. They should have been removed by now, except CFI Saved Reg spills.
+static bool allStackObjectsAreDead(const MachineFunction &MF) {
+  const MachineFrameInfo &MFI = MF.getFrameInfo();
+  const SIMachineFunctionInfo *FuncInfo = MF.getInfo<SIMachineFunctionInfo>();
+  for (int I = MFI.getObjectIndexBegin(), E = MFI.getObjectIndexEnd(); I != E;
+       ++I) {
+    if (!MFI.isDeadObjectIndex(I)) {
+      // determineCalleeSaves() might have added the SGPRSpill stack IDs for
+      // CFI saves into scratch VGPR, ignore them
+      if (MFI.getStackID(I) == TargetStackID::SGPRSpill &&
----------------
slinder1 wrote:

Yes, I think I didn't go back and reconsider some of what amounts to workarounds when preparing to upstream. I will clean these up

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


More information about the llvm-branch-commits mailing list