IR: Invert logic to simplify control flow, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 12 Jan 2015 19:45:44 +0000 (19:45 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 12 Jan 2015 19:45:44 +0000 (19:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225670 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Metadata.cpp

index f78e7d2534d9e3dabf68ea18b0c5d1af21557bc8..859512db001585cf77e417b6d37f9edf3ee1361c 100644 (file)
@@ -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();
 }