[llvm] [AMDGPU] Reland "Remove leftover implicit operands from SI_SPILL/SI_RESTORE" (PR #169449)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 25 06:02:59 PST 2025
================
@@ -2094,11 +2094,21 @@ bool SIInstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
break;
case AMDGPU::SI_SPILL_S32_TO_VGPR:
- MI.setDesc(get(AMDGPU::V_WRITELANE_B32));
+ mutateAndCleanupImplicit(MI, get(AMDGPU::V_WRITELANE_B32));
+ // When leftover implicit-def operands are removed, kill flag is no longer
+ // valid. Thus:
+ // $X = SI_SPILL_S32_TO_VGPR killed $sgpr0, 0, $X(tied-def 0),
+ // implicit-def $sgpr0_sgpr1, implicit $sgpr0_sgpr1
+ // must be converted to:
+ // $X = V_WRITELANE_B32 $sgpr0, 0, $X(tied-def 0)
+ MI.getOperand(1).setIsKill(false);
+ // Sometimes a SGPR that has already been killed is spilled.
+ // Add undef to appease the MachineVerifier.
+ MI.getOperand(1).setIsUndef(true);
----------------
arsenm wrote:
This part does not. Can you add mir test function for these cases
https://github.com/llvm/llvm-project/pull/169449
More information about the llvm-commits
mailing list