IR: Separate out decrementUnresolvedOperandCount(), NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225667 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-01-12 19:43:15 +00:00
parent aea8ab800f
commit 2912990d86
2 changed files with 9 additions and 6 deletions

View File

@ -763,6 +763,7 @@ private:
void resolve();
void resolveAfterOperandChange(Metadata *Old, Metadata *New);
void decrementUnresolvedOperandCount();
};
/// \brief Forward declaration of metadata.

View File

@ -228,8 +228,7 @@ void ReplaceableMetadataImpl::resolveAllUses(bool ResolveUsers) {
continue;
if (OwnerMD->isResolved())
continue;
if (!--OwnerMD->SubclassData32)
OwnerMD->resolve();
OwnerMD->decrementUnresolvedOperandCount();
}
}
@ -455,16 +454,19 @@ void GenericMDNode::resolveAfterOperandChange(Metadata *Old, Metadata *New) {
// Check if the last unresolved operand has just been resolved; if so,
// resolve this as well.
if (isOperandUnresolved(Old)) {
if (!isOperandUnresolved(New)) {
if (!--SubclassData32)
resolve();
}
if (!isOperandUnresolved(New))
decrementUnresolvedOperandCount();
} else {
// Operands shouldn't become unresolved.
assert(isOperandUnresolved(New) && "Operand just became unresolved");
}
}
void GenericMDNode::decrementUnresolvedOperandCount() {
if (!--SubclassData32)
resolve();
}
void GenericMDNode::resolveCycles() {
if (isResolved())
return;