aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LazyCallGraph.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-04-23 22:28:13 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-04-23 22:28:13 +0000
commitb4a04da0b982bcb3e4b9f7a0e539066e4f95496f (patch)
tree17ebcb6c8743d5f18ba09845cd53c582a244c83d /llvm/lib/Analysis/LazyCallGraph.cpp
parent885a33a0a3092d866227b5cde28c21c51a7e7f61 (diff)
downloadllvm-b4a04da0b982bcb3e4b9f7a0e539066e4f95496f.zip
llvm-b4a04da0b982bcb3e4b9f7a0e539066e4f95496f.tar.gz
llvm-b4a04da0b982bcb3e4b9f7a0e539066e4f95496f.tar.bz2
[LCG] Switch the primary SCC building code to use the negative low-link
values rather than an expensive dense map query to test whether children have already been popped into an SCC. This matches the incremental SCC building code. I've also included the assert that I put there but updated both of their text. No functionality changed here. I still don't have any great ideas for sharing the code between the two implementations, but I may try a brute-force approach to factoring it at some point. llvm-svn: 207042
Diffstat (limited to 'llvm/lib/Analysis/LazyCallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/LazyCallGraph.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp
index 48d43ea..4ad6375 100644
--- a/llvm/lib/Analysis/LazyCallGraph.cpp
+++ b/llvm/lib/Analysis/LazyCallGraph.cpp
@@ -260,7 +260,7 @@ LazyCallGraph::SCC::removeInternalEdge(LazyCallGraph &G, Node &Caller,
// Track the lowest link of the childen, if any are still in the stack.
// Any child not on the stack will have a LowLink of -1.
assert(ChildN->LowLink != 0 &&
- "Impossible with a non-zero DFS number.");
+ "Low-link must not be zero with a non-zero DFS number.");
if (ChildN->LowLink >= 0 && ChildN->LowLink < N->LowLink)
N->LowLink = ChildN->LowLink;
}
@@ -465,7 +465,9 @@ LazyCallGraph::SCC *LazyCallGraph::getNextSCCInPostOrder() {
}
// Track the lowest link of the childen, if any are still in the stack.
- if (ChildN->LowLink < N->LowLink && !SCCMap.count(&ChildN->getFunction()))
+ assert(ChildN->LowLink != 0 &&
+ "Low-link must not be zero with a non-zero DFS number.");
+ if (ChildN->LowLink >= 0 && ChildN->LowLink < N->LowLink)
N->LowLink = ChildN->LowLink;
}
// No more children to process for this stack entry.