IR: Simplify MDNode::setOperand(), NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 19:29:25 +0000 (19:29 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 19:29:25 +0000 (19:29 +0000)
llvm-svn: 226492

llvm/lib/IR/Metadata.cpp

index 39d76c5..6ccb55d 100644 (file)
@@ -758,11 +758,7 @@ void MDNode::replaceOperandWith(unsigned I, Metadata *New) {
 
 void MDNode::setOperand(unsigned I, Metadata *New) {
   assert(I < NumOperands);
-  if (isStoredDistinctInContext() || isa<MDNodeFwdDecl>(this))
-    // No need for a callback, this isn't uniqued.
-    mutable_begin()[I].reset(New, nullptr);
-  else
-    mutable_begin()[I].reset(New, this);
+  mutable_begin()[I].reset(New, isUniqued() ? this : nullptr);
 }
 
 /// \brief Get a node, or a self-reference that looks like it.