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

Oliver Stannard via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 06:09:59 PST 2025


================
@@ -978,9 +1012,11 @@ void MachineCopyPropagation::ForwardCopyPropagateBlock(MachineBasicBlock &MBB) {
         LLVM_DEBUG(dbgs() << "MCP: Removing copy due to regmask clobbering: ";
                    MaybeDead->dump());
 
-        // Make sure we invalidate any entries in the copy maps before erasing
-        // the instruction.
-        Tracker.clobberRegister(Reg, *TRI, *TII, UseCopyInstr);
+        // Invalidate all entries in the copy map which are not preserved by
+        // this register mask.
+        for (unsigned RegUnit : TRI->regunits(Reg))
+          if (!PreservedRegUnits.test(RegUnit))
----------------
ostannard wrote:

Great, could you send that as a PR? I think it should be possible to hit this with the ARM floating-point register classes, but I've not managed to work out the details yet.

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


More information about the llvm-commits mailing list