summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-30 21:18:41 +0000
committerDan Gohman <gohman@apple.com>2010-08-30 21:18:41 +0000
commit62ddc15f0665e35f5a19fcb28f7a611734b7c08d (patch)
tree57e2ac6f1ba31f2ed5c6722c356e50fcacdd9299 /llvm/lib
parenteb433971816bdc581282f29cf282fcb0ee72da6b (diff)
downloadbcm5719-llvm-62ddc15f0665e35f5a19fcb28f7a611734b7c08d.tar.gz
bcm5719-llvm-62ddc15f0665e35f5a19fcb28f7a611734b7c08d.zip
Add comments explaining why it's not necessary to include the
is-function-local flag in metadata uniquing bits. llvm-svn: 112528
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Metadata.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp
index 17e0bc28da0..b9f97dbf603 100644
--- a/llvm/lib/VMCore/Metadata.cpp
+++ b/llvm/lib/VMCore/Metadata.cpp
@@ -190,6 +190,8 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals,
// 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 @@ Value *MDNode::getOperand(unsigned i) const {
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 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
// 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;
OpenPOWER on IntegriCloud