[llvm] [MCP] Enhance MCP copy Instruction removal for special case (PR #70778)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 31 05:34:26 PDT 2023
================
@@ -735,6 +736,27 @@ void MachineCopyPropagation::ForwardCopyPropagateBlock(MachineBasicBlock &MBB) {
MCRegister Def = RegDef.asMCReg();
MCRegister Src = RegSrc.asMCReg();
+ // Target may lost some opportunity to further remove the redundant
+ // copy instruction, consider the following sequence:
+ // L1: r0 = COPY r9 <- TrackMI
+ // L2: r0 = COPY r8 <- TrackMI
----------------
qcolombet wrote:
Shouldn't we forget about L1 when we get to L2?
I think the underlying issue is that when we reach L4, L2 shouldn't be in the tracker copy anyway.
Now, regarding the fix itself, just glancing at the code, I believe it is not general enough. For instance, what happens if I have an unrelated `COPY` between L1 and L2?
https://github.com/llvm/llvm-project/pull/70778
More information about the llvm-commits
mailing list