[llvm] r225670 - IR: Invert logic to simplify control flow, NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Jan 12 11:45:44 PST 2015
Author: dexonsmith
Date: Mon Jan 12 13:45:44 2015
New Revision: 225670
URL: http://llvm.org/viewvc/llvm-project?rev=225670&view=rev
Log:
IR: Invert logic to simplify control flow, NFC
Modified:
llvm/trunk/lib/IR/Metadata.cpp
Modified: llvm/trunk/lib/IR/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Metadata.cpp?rev=225670&r1=225669&r2=225670&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Metadata.cpp (original)
+++ llvm/trunk/lib/IR/Metadata.cpp Mon Jan 12 13:45:44 2015
@@ -451,19 +451,16 @@ void GenericMDNode::resolve() {
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))
- decrementUnresolvedOperandCount();
- } else {
- // Operands shouldn't become unresolved.
+ // Check if an operand was resolved.
+ if (!isOperandUnresolved(Old))
assert(isOperandUnresolved(New) && "Operand just became unresolved");
- }
+ else if (!isOperandUnresolved(New))
+ decrementUnresolvedOperandCount();
}
void GenericMDNode::decrementUnresolvedOperandCount() {
if (!--SubclassData32)
+ // Last unresolved operand has just been resolved.
resolve();
}
More information about the llvm-commits
mailing list