[llvm-commits] [llvm] r157146 - /llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Sat May 19 20:57:12 PDT 2012


Author: stoklund
Date: Sat May 19 22:57:12 2012
New Revision: 157146

URL: http://llvm.org/viewvc/llvm-project?rev=157146&view=rev
Log:
Fix build bots.

Avoid looking at the operands of a potentially erased instruction.

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

Modified: llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?rev=157146&r1=157145&r2=157146&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp Sat May 19 22:57:12 2012
@@ -1441,10 +1441,10 @@
   // Now erase all the redundant copies.
   for (unsigned i = 0, e = DeadCopies.size(); i != e; ++i) {
     MachineInstr *MI = DeadCopies[i];
-    DEBUG(dbgs() << "\t\terased:\t" << LIS->getInstructionIndex(MI)
-                 << '\t' << *MI);
     if (!ErasedInstrs.insert(MI))
       continue;
+    DEBUG(dbgs() << "\t\terased:\t" << LIS->getInstructionIndex(MI)
+                 << '\t' << *MI);
     LIS->RemoveMachineInstrFromMaps(MI);
     MI->eraseFromParent();
   }
@@ -1453,6 +1453,8 @@
   for (SmallVector<MachineInstr*, 8>::iterator I = DupCopies.begin(),
          E = DupCopies.end(); I != E; ++I) {
     MachineInstr *MI = *I;
+    if (!ErasedInstrs.insert(MI))
+      continue;
 
     // We have pretended that the assignment to B in
     // A = X
@@ -1462,8 +1464,6 @@
     // A = X
     unsigned Src = MI->getOperand(1).getReg();
     SourceRegisters.push_back(Src);
-    if (!ErasedInstrs.insert(MI))
-      continue;
     LIS->RemoveMachineInstrFromMaps(MI);
     MI->eraseFromParent();
   }





More information about the llvm-commits mailing list