[llvm] [Peephole] Check instructions from CopyMIs are still COPY (PR #69511)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 22:57:31 PDT 2023
================
@@ -1445,7 +1445,9 @@ bool PeepholeOptimizer::foldRedundantCopy(
}
MachineInstr *PrevCopy = CopyMIs.find(SrcPair)->second;
- if (!LocalMIs.count(PrevCopy))
+ // A COPY instruction can be deleted or changed by other optimizations.
+ // Check if the previous COPY instruction is existing and still a COPY.
+ if (!LocalMIs.count(PrevCopy) || !PrevCopy->isCopy())
----------------
qcolombet wrote:
Note: If it is okay to wait a bit longer for the fix, please implement the delegate instead.
https://github.com/llvm/llvm-project/pull/69511
More information about the llvm-commits
mailing list