[llvm-commits] [llvm] r144147 - /llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Nov 8 15:26:00 PST 2011


Author: stoklund
Date: Tue Nov  8 17:26:00 2011
New Revision: 144147

URL: http://llvm.org/viewvc/llvm-project?rev=144147&view=rev
Log:
Track reference count independently from clear().

This allows clear() to be called on a DomainValue with references.

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

Modified: llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp?rev=144147&r1=144146&r2=144147&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp (original)
+++ llvm/trunk/lib/CodeGen/ExecutionDepsFix.cpp Tue Nov  8 17:26:00 2011
@@ -92,10 +92,10 @@
     return CountTrailingZeros_32(AvailableDomains);
   }
 
-  DomainValue() { clear(); }
+  DomainValue() : Refs(0) { clear(); }
 
   void clear() {
-    Refs = AvailableDomains = Dist = 0;
+    AvailableDomains = Dist = 0;
     Instrs.clear();
   }
 };
@@ -173,6 +173,7 @@
   dv->Dist = Distance;
   if (domain >= 0)
     dv->addDomain(domain);
+  assert(dv->Refs == 0 && "Reference count wasn't cleared");
   return dv;
 }
 
@@ -271,8 +272,7 @@
   A->Instrs.append(B->Instrs.begin(), B->Instrs.end());
 
   // Clear the old DomainValue so we won't try to swizzle instructions twice.
-  B->Instrs.clear();
-  B->AvailableDomains = 0;
+  B->clear();
 
   for (unsigned rx = 0; rx != NumRegs; ++rx)
     if (LiveRegs[rx] == B)





More information about the llvm-commits mailing list