]> granicus.if.org Git - llvm/commitdiff
IR: Cleanup MDNode::MDNode(), NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 23:15:21 +0000 (23:15 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 23:15:21 +0000 (23:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226521 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Metadata.cpp

index 0310ee776c95f918e3b398b5e7de65c7eb741f5d..fb70149330b5c481af762b3ac060e86aab4a5ea0 100644 (file)
@@ -403,20 +403,19 @@ MDNode::MDNode(LLVMContext &Context, unsigned ID, StorageType Storage,
   for (unsigned I = 0, E = MDs.size(); I != E; ++I)
     setOperand(I, MDs[I]);
 
-  if (isTemporary())
-    this->Context.makeReplaceable(
-        make_unique<ReplaceableMetadataImpl>(Context));
-
-  if (!isUniqued())
+  if (isDistinct())
     return;
 
-  // Check whether any operands are unresolved, requiring re-uniquing.
-  unsigned NumUnresolved = countUnresolvedOperands();
-  if (!NumUnresolved)
-    return;
+  if (isUniqued()) {
+    // Check whether any operands are unresolved, requiring re-uniquing.
+    unsigned NumUnresolved = countUnresolvedOperands();
+    if (!NumUnresolved)
+      return;
+
+    SubclassData32 = NumUnresolved;
+  }
 
   this->Context.makeReplaceable(make_unique<ReplaceableMetadataImpl>(Context));
-  SubclassData32 = NumUnresolved;
 }
 
 static bool isOperandUnresolved(Metadata *Op) {