diff options
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r-- | llvm/lib/IR/Metadata.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 01394137e8e..0e258623368 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -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"); |