[llvm] r226492 - IR: Simplify MDNode::setOperand(), NFC

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Jan 19 11:29:25 PST 2015


Author: dexonsmith
Date: Mon Jan 19 13:29:25 2015
New Revision: 226492

URL: http://llvm.org/viewvc/llvm-project?rev=226492&view=rev
Log:
IR: Simplify MDNode::setOperand(), 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=226492&r1=226491&r2=226492&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Metadata.cpp (original)
+++ llvm/trunk/lib/IR/Metadata.cpp Mon Jan 19 13:29:25 2015
@@ -758,11 +758,7 @@ void MDNode::replaceOperandWith(unsigned
 
 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.





More information about the llvm-commits mailing list