[llvm] r226521 - IR: Cleanup MDNode::MDNode(), NFC

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Jan 19 15:15:21 PST 2015


Author: dexonsmith
Date: Mon Jan 19 17:15:21 2015
New Revision: 226521

URL: http://llvm.org/viewvc/llvm-project?rev=226521&view=rev
Log:
IR: Cleanup MDNode::MDNode(), 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=226521&r1=226520&r2=226521&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Metadata.cpp (original)
+++ llvm/trunk/lib/IR/Metadata.cpp Mon Jan 19 17:15:21 2015
@@ -403,20 +403,19 @@ MDNode::MDNode(LLVMContext &Context, uns
   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) {





More information about the llvm-commits mailing list