[PATCH] D67794: [MachineCopyPropagation] Extend MCP to do trivial copy backward propagation

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 00:58:33 PDT 2019


lkail added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineCopyPropagation.cpp:328
+    }
+  }
+  if (!SrcMI || !isSafeBackwardCopyPropagation(Copy, *SrcMI))
----------------
qcolombet wrote:
> Could you build this information as we iterate into the basic block?
> I am afraid the compile time cost of this loop to be fairly large otherwise, since we are going to traverse all the instructions between two instructions again and again.
I find that it might be non-trivial to track information that help perform backward copy propagation in current forward iteration. Would it be a proper option that separating current main loop into two parts, one performs forward copy propagation, the other performs backward copy propagation? i.e.
```
  for (MachineBasicBlock &MBB : MF) {
    ForwardCopyPropagateBlock(MBB); // Current CopyPropagateBlock
    BackwardCopyPropagateBlock(MBB);
  }
```
In `BackwardCopyPropagateBlock`, iterate instructions reversely. Cons is increasing constant complexity.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67794/new/

https://reviews.llvm.org/D67794





More information about the llvm-commits mailing list