IR: Split out countUnresolvedOperands(), NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226508 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-01-19 22:18:29 +00:00
parent b463149129
commit 0927997ce8
2 changed files with 9 additions and 4 deletions

View File

@ -843,6 +843,7 @@ private:
void resolve();
void resolveAfterOperandChange(Metadata *Old, Metadata *New);
void decrementUnresolvedOperandCount();
unsigned countUnresolvedOperands() const;
void deleteAsSubclass();
UniquableMDNode *uniquify();

View File

@ -421,10 +421,7 @@ UniquableMDNode::UniquableMDNode(LLVMContext &C, unsigned ID,
return;
// Check whether any operands are unresolved, requiring re-uniquing.
unsigned NumUnresolved = 0;
for (const auto &Op : operands())
NumUnresolved += unsigned(isOperandUnresolved(Op));
unsigned NumUnresolved = countUnresolvedOperands();
if (!NumUnresolved)
return;
@ -432,6 +429,13 @@ UniquableMDNode::UniquableMDNode(LLVMContext &C, unsigned ID,
SubclassData32 = NumUnresolved;
}
unsigned UniquableMDNode::countUnresolvedOperands() const {
unsigned NumUnresolved = 0;
for (const auto &Op : operands())
NumUnresolved += unsigned(isOperandUnresolved(Op));
return NumUnresolved;
}
void UniquableMDNode::resolve() {
assert(isUniqued() && "Expected this to be uniqued");
assert(!isResolved() && "Expected this to be unresolved");