IR: Don't allow operands to become unresolved

Operands shouldn't change from being resolved to unresolved during graph
construction.  Simplify the logic based on that assumption.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225649 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-01-12 18:59:40 +00:00
parent 1478aabb18
commit 54b53edbd9

View File

@ -547,13 +547,17 @@ void GenericMDNode::handleChangedOperand(void *Ref, Metadata *New) {
if (!isResolved()) {
// Check if the last unresolved operand has just been resolved; if so,
// resolve this as well.
if (isOperandUnresolved(Old))
if (isOperandUnresolved(Old)) {
if (!isOperandUnresolved(New)) {
decrementUnresolvedOperands();
if (isOperandUnresolved(New))
incrementUnresolvedOperands();
if (!hasUnresolvedOperands())
resolve();
}
} else {
// Operands shouldn't become unresolved.
assert(isOperandUnresolved(New) && "Operand just became unresolved");
}
}
return;
}