Skip to content

Commit

Permalink
[LCG] Rather than walking the directed graph structure to update graph
Browse files Browse the repository at this point in the history
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310163 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chandlerc committed Aug 5, 2017
1 parent fa10468 commit e9f7200
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions lib/Analysis/LazyCallGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e9f7200

Please sign in to comment.