aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LazyCallGraph.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-04-26 03:36:37 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-04-26 03:36:37 +0000
commita7205b6154dd16482fb02d3a5fe54da11fc9a060 (patch)
tree063bb0bd604c82adea558866c979e85427d41946 /llvm/lib/Analysis/LazyCallGraph.cpp
parenta6bda8bae25be0b1cc0fa64fa7035a47e3a3b6a2 (diff)
downloadllvm-a7205b6154dd16482fb02d3a5fe54da11fc9a060.zip
llvm-a7205b6154dd16482fb02d3a5fe54da11fc9a060.tar.gz
llvm-a7205b6154dd16482fb02d3a5fe54da11fc9a060.tar.bz2
[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-svn: 207305
Diffstat (limited to 'llvm/lib/Analysis/LazyCallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/LazyCallGraph.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp
index f7f1010..2621288 100644
--- a/llvm/lib/Analysis/LazyCallGraph.cpp
+++ b/llvm/lib/Analysis/LazyCallGraph.cpp
@@ -188,6 +188,10 @@ LazyCallGraph::SCC::removeInternalEdge(LazyCallGraph &G, Node &Caller,
SmallVector<SCC *, 1> ResultSCCs;
ResultSCCs.push_back(this);
+ // 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.
int NextDFSNumber;
SmallVector<std::pair<Node *, Node::iterator>, 4> DFSStack;
@@ -202,6 +206,8 @@ LazyCallGraph::SCC::removeInternalEdge(LazyCallGraph &G, Node &Caller,
N->LowLink = 0;
G.SCCMap.erase(N);
}
+ 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