mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
[RegisterCoalescer] Account for instructions deleted by removePartialredunduncy and in WorkList
Summary: removePartialRedundency optimization introduces a state in the RegisterCoalescer where an instruction pointed to in the WorkList is deleted from the MBB and then removed from the ErasedList. This patch updates the ErasedList to be used globally by not erasing erased Instructions from it to solve the problem. The patch also accounts for the case where an Instruction was previously deleted and the same memory was reused by BuildMI to create a new instruction. Reviewers: kparzysz, qcolombet Reviewed By: qcolombet Subscribers: MatzeB, qcolombet, llvm-commits Differential Revision: https://reviews.llvm.org/D34902 llvm-svn: 306915
This commit is contained in:
parent
d043f8fdc1
commit
b724aa3c1a
@ -979,6 +979,11 @@ bool RegisterCoalescer::removePartialRedundancy(const CoalescerPair &CP,
|
||||
IntB.createDeadDef(NewCopyIdx, LIS->getVNInfoAllocator());
|
||||
for (LiveInterval::SubRange &SR : IntB.subranges())
|
||||
SR.createDeadDef(NewCopyIdx, LIS->getVNInfoAllocator());
|
||||
|
||||
// If the newly created Instruction has an address of an instruction that was
|
||||
// deleted before (object recycled by the allocator) it needs to be removed from
|
||||
// the deleted list.
|
||||
ErasedInstrs.erase(NewCopyMI);
|
||||
} else {
|
||||
DEBUG(dbgs() << "\tremovePartialRedundancy: Remove the copy from BB#"
|
||||
<< MBB.getNumber() << '\t' << CopyMI);
|
||||
@ -989,6 +994,8 @@ bool RegisterCoalescer::removePartialRedundancy(const CoalescerPair &CP,
|
||||
// While updating the live-ranges, we only look at slot indices and
|
||||
// never go back to the instruction.
|
||||
LIS->RemoveMachineInstrFromMaps(CopyMI);
|
||||
// Mark instructions as deleted.
|
||||
ErasedInstrs.insert(&CopyMI);
|
||||
CopyMI.eraseFromParent();
|
||||
|
||||
// Update the liveness.
|
||||
@ -3095,7 +3102,7 @@ copyCoalesceWorkList(MutableArrayRef<MachineInstr*> CurrList) {
|
||||
continue;
|
||||
// Skip instruction pointers that have already been erased, for example by
|
||||
// dead code elimination.
|
||||
if (ErasedInstrs.erase(CurrList[i])) {
|
||||
if (ErasedInstrs.count(CurrList[i])) {
|
||||
CurrList[i] = nullptr;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user