[llvm] [AMDGPU] Prevent generation of unused SGPR IMPLICIT_DEF assignments (PR #155241)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 18:49:05 PDT 2025


================
@@ -8063,12 +8063,9 @@ void SIInstrInfo::moveToVALUImpl(SIInstrWorklist &Worklist,
       MRI.replaceRegWith(DstReg, NewDstReg);
       MRI.clearKillFlags(NewDstReg);
       Inst.getOperand(0).setReg(DstReg);
-      // Make sure we don't leave around a dead VGPR->SGPR copy. Normally
-      // these are deleted later, but at -O0 it would leave a suspicious
-      // looking illegal copy of an undef register.
-      for (unsigned I = Inst.getNumOperands() - 1; I != 0; --I)
-        Inst.removeOperand(I);
-      Inst.setDesc(get(AMDGPU::IMPLICIT_DEF));
+      // Completely remove dead VGPR->SGPR copies and ensure that dead
+      // assignments to IMPLICIT_DEF are not created.
----------------
arsenm wrote:

```suggestion
```

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


More information about the llvm-commits mailing list