[llvm] [RegisterPressure] Remove dead defs correctly (PR #156576)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 03:02:01 PDT 2025


================
@@ -477,17 +477,17 @@ class RegisterOperandsCollector {
       collectOperand(*OperI);
 
     // Remove redundant physreg dead defs.
-    for (const VRegMaskOrUnit &P : RegOpers.Defs)
-      removeRegLanes(RegOpers.DeadDefs, P);
+    for (const VRegMaskOrUnit &P : RegOpers.DeadDefs)
----------------
sdesmalen-arm wrote:

I don't think this is correct, because for a MachineInstr like the one from the test below:
```dead $eax = MOV32r0 implicit-def dead $eflags, implicit-def $rax```
this function results with `RegOpers.DeadDefs = {AH, AL, HAX}` and `RegOpers.Defs = {}`, suggesting that no regunits are live from this instruction, whereas the opposite should be true.


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


More information about the llvm-commits mailing list