================ @@ -784,18 +813,33 @@ void MachineCopyPropagation::ForwardCopyPropagateBlock(MachineBasicBlock &MBB) { // %xmm2 = copy %xmm0 // ... // %xmm2 = copy %xmm9 - Tracker.clobberRegister(Def, *TRI, *TII, UseCopyInstr); + + // While we do need to clobber the register here, simply clobbering it + // is not sufficient. We also need to remove the COPY record pair for + // 'Def' in the tracker. Failing to do so might cause the target to miss + // some opportunities to eliminate redundant copy instructions. + + // Consider the following sequence: + // L1: r0 = COPY r9 <- TrackMI + // L2: r0 = COPY r8 <- TrackMI + // L3: use r0 <- Remove L2 from MaybeDeadCopies + // L4: early-clobber r9 <- Invalid L2 from Tracker + // L5: r0 = COPY r8 <- Miss remove chance + // L6: use r0 <- Miss remove L5 chance ---------------- qcolombet wrote:
Rewrite this comment to explain what will happen now. Not what was happening before this patch. https://github.com/llvm/llvm-project/pull/70778 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits