IR: Separate out helper: resolveAfterOperandChange(), NFC

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

View File

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

View File

@ -449,6 +449,22 @@ void GenericMDNode::resolve() {
Uses->resolveAllUses();
}
void GenericMDNode::resolveAfterOperandChange(Metadata *Old, Metadata *New) {
assert(SubclassData32 != 0 && "Expected unresolved operands");
// 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();
}
} else {
// Operands shouldn't become unresolved.
assert(isOperandUnresolved(New) && "Operand just became unresolved");
}
}
void GenericMDNode::resolveCycles() {
if (isResolved())
return;
@ -546,21 +562,8 @@ void GenericMDNode::handleChangedOperand(void *Ref, Metadata *New) {
if (I == Store.end()) {
Store.insert(this);
if (!isResolved()) {
assert(SubclassData32 != 0 && "Expected unresolved operands");
// 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();
}
} else {
// Operands shouldn't become unresolved.
assert(isOperandUnresolved(New) && "Operand just became unresolved");
}
}
if (!isResolved())
resolveAfterOperandChange(Old, New);
return;
}