[PATCH] D34902: [RegisterCoalescer] Account for instructions deleted by removePartialredunduncy and in WorkList

Sameer AbuAsal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 16:49:24 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL306915: [RegisterCoalescer] Account for instructions deleted by removePartialredunduncy… (authored by sabuasal).

Changed prior to commit:
  https://reviews.llvm.org/D34902?vs=104908&id=104961#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34902

Files:
  llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp


Index: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
@@ -979,6 +979,11 @@
     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 @@
   // 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 @@
       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;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34902.104961.patch
Type: text/x-patch
Size: 1395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170630/17f3b41a/attachment.bin>


More information about the llvm-commits mailing list