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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226492 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Metadata.cpp

index 39d76c51d0d62bf0a608184b91560f5cbf1e47fc..6ccb55d18b29b2b5e7548aeddd1176d8c0234771 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.