[llvm-commits] [llvm] r112528 - /llvm/trunk/lib/VMCore/Metadata.cpp

Dan Gohman gohman at apple.com
Mon Aug 30 14:18:41 PDT 2010


Author: djg
Date: Mon Aug 30 16:18:41 2010
New Revision: 112528

URL: http://llvm.org/viewvc/llvm-project?rev=112528&view=rev
Log:
Add comments explaining why it's not necessary to include the
is-function-local flag in metadata uniquing bits.

Modified:
    llvm/trunk/lib/VMCore/Metadata.cpp

Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=112528&r1=112527&r2=112528&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Mon Aug 30 16:18:41 2010
@@ -190,6 +190,8 @@
 
   // Add all the operand pointers. Note that we don't have to add the
   // isFunctionLocal bit because that's implied by the operands.
+  // Note that if the operands are later nulled out, the node will be
+  // removed from the uniquing map.
   FoldingSetNodeID ID;
   for (unsigned i = 0; i != NumVals; ++i)
     ID.AddPointer(Vals[i]);
@@ -276,6 +278,8 @@
 void MDNode::Profile(FoldingSetNodeID &ID) const {
   // Add all the operand pointers. Note that we don't have to add the
   // isFunctionLocal bit because that's implied by the operands.
+  // Note that if the operands are later nulled out, the node will be
+  // removed from the uniquing map.
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
     ID.AddPointer(getOperand(i));
 }
@@ -326,7 +330,8 @@
 
   // If we are dropping an argument to null, we choose to not unique the MDNode
   // anymore.  This commonly occurs during destruction, and uniquing these
-  // brings little reuse.
+  // brings little reuse.  Also, this means we don't need to include
+  // isFunctionLocal bits in FoldingSetNodeIDs for MDNodes.
   if (To == 0) {
     setIsNotUniqued();
     return;





More information about the llvm-commits mailing list