[llvm] r207305 - [LCG] Special case the removal of self edges. These don't impact the SCC
chandlerc at gmail.com
Fri Apr 25 20:36:37 PDT 2014
Date: Fri Apr 25 22:36:37 2014
New Revision: 207305
[LCG] Special case the removal of self edges. These don't impact the SCC
graph in any way because we don't track edges in the SCC graph, just
nodes. This also lets us add a nice assert about the invariant that
we're working on at least a certain number of nodes within the SCC.
--- llvm/trunk/lib/Analysis/LazyCallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyCallGraph.cpp Fri Apr 25 22:36:37 2014
@@ -188,6 +188,10 @@ LazyCallGraph::SCC::removeInternalEdge(L
SmallVector<SCC *, 1> ResultSCCs;
+ // Direct recursion doesn't impact the SCC graph at all.
+ if (&Caller == &Callee)
+ return ResultSCCs;
// We're going to do a full mini-Tarjan's walk using a local stack here.
SmallVector<std::pair<Node *, Node::iterator>, 4> DFSStack;
@@ -202,6 +206,8 @@ LazyCallGraph::SCC::removeInternalEdge(L
N->LowLink = 0;
+ assert(Worklist.size() > 1 && "We have to have at least two nodes to have an "
+ "edge between them that is within the SCC.");
// The callee can already reach every node in this SCC (by definition). It is
// the only node we know will stay inside this SCC. Everything which
More information about the llvm-commits