summaryrefslogtreecommitdiff
path: root/lib/CodeGen/ExecutionDepsFix.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-11-08 23:26:00 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-11-08 23:26:00 +0000
commit737e9a2db27b9c3b212ff64fda7af5537ecbfb45 (patch)
treeedb4797dca31429a2cf248180532332560a4953e /lib/CodeGen/ExecutionDepsFix.cpp
parentce1a538ab5b7ae7e0ed48d18c02571280fe105aa (diff)
downloadllvm-737e9a2db27b9c3b212ff64fda7af5537ecbfb45.tar.gz
llvm-737e9a2db27b9c3b212ff64fda7af5537ecbfb45.tar.bz2
llvm-737e9a2db27b9c3b212ff64fda7af5537ecbfb45.tar.xz
Track reference count independently from clear().
This allows clear() to be called on a DomainValue with references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ExecutionDepsFix.cpp')
-rw-r--r--lib/CodeGen/ExecutionDepsFix.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/ExecutionDepsFix.cpp b/lib/CodeGen/ExecutionDepsFix.cpp
index 5a75fde2d6..9a7a2890ef 100644
--- a/lib/CodeGen/ExecutionDepsFix.cpp
+++ b/lib/CodeGen/ExecutionDepsFix.cpp
@@ -92,10 +92,10 @@ struct DomainValue {
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 @@ DomainValue *ExeDepsFix::alloc(int domain) {
dv->Dist = Distance;
if (domain >= 0)
dv->addDomain(domain);
+ assert(dv->Refs == 0 && "Reference count wasn't cleared");
return dv;
}
@@ -271,8 +272,7 @@ bool ExeDepsFix::merge(DomainValue *A, DomainValue *B) {
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)