[llvm] [RegisterCoalescer] Deferring deletion of instructions in `ErasedInstrs` until the end of an iteration (PR #79820)
Quentin Dian via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 12:12:47 PST 2024
================
@@ -2156,7 +2159,9 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) {
// CopyMI has been erased by joinIntervals at this point. Remove it from
// ErasedInstrs since copyCoalesceWorkList() won't add a successful join back
// to the work list. This keeps ErasedInstrs from growing needlessly.
- ErasedInstrs.erase(CopyMI);
+ if (ErasedInstrs.erase(CopyMI))
+ // But we may encounter the instruction again in this iteration.
+ CurrentErasedInstrs.insert(CopyMI);
----------------
DianQK wrote:
>From the debugging results, it looks like `removePartialRedundancy` changes the contents of the work list.
https://github.com/llvm/llvm-project/pull/79820
More information about the llvm-commits
mailing list