IR: Use SubclassData32 directly, NFC

Simplify some logic by accessing `SubclassData32` directly instead of
relying on API.

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

View File

@ -761,9 +761,6 @@ public:
private:
void handleChangedOperand(void *Ref, Metadata *New);
bool hasUnresolvedOperands() const { return SubclassData32; }
void incrementUnresolvedOperands() { ++SubclassData32; }
void decrementUnresolvedOperands() { --SubclassData32; }
void resolve();
};

View File

@ -228,8 +228,7 @@ void ReplaceableMetadataImpl::resolveAllUses(bool ResolveUsers) {
continue;
if (OwnerMD->isResolved())
continue;
OwnerMD->decrementUnresolvedOperands();
if (!OwnerMD->hasUnresolvedOperands())
if (!--OwnerMD->SubclassData32)
OwnerMD->resolve();
}
}
@ -418,12 +417,15 @@ GenericMDNode::GenericMDNode(LLVMContext &C, ArrayRef<Metadata *> Vals,
return;
// Check whether any operands are unresolved, requiring re-uniquing.
unsigned NumUnresolved = 0;
for (const auto &Op : operands())
if (isOperandUnresolved(Op))
incrementUnresolvedOperands();
NumUnresolved += unsigned(isOperandUnresolved(Op));
if (!NumUnresolved)
return;
if (hasUnresolvedOperands())
ReplaceableUses.reset(new ReplaceableMetadataImpl);
SubclassData32 = NumUnresolved;
}
GenericMDNode::~GenericMDNode() {
@ -545,12 +547,13 @@ void GenericMDNode::handleChangedOperand(void *Ref, Metadata *New) {
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)) {
decrementUnresolvedOperands();
if (!hasUnresolvedOperands())
if (!--SubclassData32)
resolve();
}
} else {