[llvm] [MachineCP] Correctly handle register masks and sub-registers (PR #122472)

Kai Luo via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 07:19:17 PST 2025


================
@@ -960,6 +984,10 @@ void MachineCopyPropagation::ForwardCopyPropagateBlock(MachineBasicBlock &MBB) {
     // a large set of registers.  Treat clobbered registers the same way as
     // defined registers.
     if (RegMask) {
+      // Invalidate all entries in the copy map which are not preserved by this
+      // register mask.
+      Tracker.clobberRegistersExceptMask(RegMask, *TRI, *TII, UseCopyInstr);
+
----------------
bzEq wrote:

At L973, can we get more precise RegUnits clobbered by the RegMask? Thus we change L983 to
```
Tracker.clobberRegUnits(<regunits-returned-at-L973>)
```

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


More information about the llvm-commits mailing list