summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-16 21:09:53 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-16 21:09:53 +0000
commit0cb5c344b4f5090373c5bad68821c3c562e8cd9a (patch)
tree12df834871f368c2857c413a9ae05097867f0fed
parentb75744ceae3cdebdd88fe6c2f12d508a611eec7c (diff)
downloadbcm5719-llvm-0cb5c344b4f5090373c5bad68821c3c562e8cd9a.tar.gz
bcm5719-llvm-0cb5c344b4f5090373c5bad68821c3c562e8cd9a.zip
ValueMapper: Only put cyclic nodes into CyclicNodes, NFCI
As a minor fixup to r266258, only track nodes that needed a placeholder in CyclicNodes in MDNodeMapper::mapUniquedNodes. There should be no observable functionality change, just some local memory savings because CyclicNodes only needs to grow to accommodate nodes that are actually involved in cycles. (This was the original intent of r266258, or else the vector would have been called "ChangedNodes".) llvm-svn: 266536
-rw-r--r--llvm/lib/Transforms/Utils/ValueMapper.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index e22922b9fbb..9f50ad18ff0 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -686,10 +686,19 @@ void MDNodeMapper::mapUniquedNodes() {
continue;
}
+ // Remember whether this node had a placeholder.
+ bool HadPlaceholder(D.Placeholder);
+
+ // Clone the uniqued node and remap the operands.
TempMDNode ClonedN = D.Placeholder ? std::move(D.Placeholder) : N->clone();
remapOperands(D, *ClonedN);
- CyclicNodes.push_back(MDNode::replaceWithUniqued(std::move(ClonedN)));
- M.mapToMetadata(N, CyclicNodes.back());
+ auto *NewN = MDNode::replaceWithUniqued(std::move(ClonedN));
+ M.mapToMetadata(N, NewN);
+
+ // Nodes that were referenced out of order in the POT are involved in a
+ // uniquing cycle.
+ if (HadPlaceholder)
+ CyclicNodes.push_back(NewN);
}
// Resolve cycles.
OpenPOWER on IntegriCloud