summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LazyCallGraph.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2017-08-05 03:37:39 +0000
committerChandler Carruth <chandlerc@gmail.com>2017-08-05 03:37:39 +0000
commit7cb23e705f72e7143a9804980eafcae75f76d757 (patch)
tree7557893dc55ebc3cb61ecbb14dd06c2ba1a9a49b /llvm/lib/Analysis/LazyCallGraph.cpp
parent2c58e1a45c6d71b256cba2dc9df726d855d1ad1e (diff)
downloadbcm5719-llvm-7cb23e705f72e7143a9804980eafcae75f76d757.tar.gz
bcm5719-llvm-7cb23e705f72e7143a9804980eafcae75f76d757.zip
[LCG] Rather than walking the directed graph structure to update graph
pointers in node objects, just walk the map from function to node. It doesn't have stable ordering, but works just as well and is much simpler. We don't need ordering when just updating internal pointers. llvm-svn: 310163
Diffstat (limited to 'llvm/lib/Analysis/LazyCallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/LazyCallGraph.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp
index 690ca7d5122..b64129b33dc 100644
--- a/llvm/lib/Analysis/LazyCallGraph.cpp
+++ b/llvm/lib/Analysis/LazyCallGraph.cpp
@@ -1684,20 +1684,10 @@ LazyCallGraph::Node &LazyCallGraph::insertInto(Function &F, Node *&MappedN) {
}
void LazyCallGraph::updateGraphPtrs() {
- // Process all nodes updating the graph pointers.
- {
- SmallVector<Node *, 16> Worklist;
- for (Edge &E : EntryEdges)
- Worklist.push_back(&E.getNode());
-
- while (!Worklist.empty()) {
- Node &N = *Worklist.pop_back_val();
- N.G = this;
- if (N)
- for (Edge &E : *N)
- Worklist.push_back(&E.getNode());
- }
- }
+ // Walk the node map to update their graph pointers. While this iterates in
+ // an unstable order, the order has no effect so it remains correct.
+ for (auto &FunctionNodePair : NodeMap)
+ FunctionNodePair.second->G = this;
for (auto *RC : PostOrderRefSCCs)
RC->G = this;
OpenPOWER on IntegriCloud