[llvm] [MachineCopyPropagation] Recognise and delete no-op moves produced after forwarded uses (PR #129889)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 7 07:50:40 PST 2025


================
@@ -971,6 +971,18 @@ void MachineCopyPropagation::ForwardCopyPropagateBlock(MachineBasicBlock &MBB) {
 
     forwardUses(MI);
 
+    // It's possible that the previous transformation has resulted in a no-op
+    // register move (i.e. one where source and destination registers are the
+    // same). If so, delete it.
+    CopyOperands = isCopyInstr(MI, *TII, UseCopyInstr);
----------------
preames wrote:

You're right, though in abstract we could organize the code to have forwardUses about the split point.  (Not asking you to do this.)

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


More information about the llvm-commits mailing list