aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LazyCallGraph.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-04-28 10:49:06 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-04-28 10:49:06 +0000
commit3f5f5fe16434381e1fc375396278d4e379a291b0 (patch)
treec3c1d66fa939060140a5409e29cd93224aed2342 /llvm/lib/Analysis/LazyCallGraph.cpp
parent5bdf72cef61095452852731e6a3259709109e009 (diff)
downloadllvm-3f5f5fe16434381e1fc375396278d4e379a291b0.zip
llvm-3f5f5fe16434381e1fc375396278d4e379a291b0.tar.gz
llvm-3f5f5fe16434381e1fc375396278d4e379a291b0.tar.bz2
[LCG] Make the return of the IntraSCC removal method actually match its
contract (and be much more useful). It now provides exactly the post-order traversal a caller might need to perform on newly formed SCCs. llvm-svn: 207410
Diffstat (limited to 'llvm/lib/Analysis/LazyCallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/LazyCallGraph.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp
index 1ac3076..b593069 100644
--- a/llvm/lib/Analysis/LazyCallGraph.cpp
+++ b/llvm/lib/Analysis/LazyCallGraph.cpp
@@ -284,10 +284,8 @@ LazyCallGraph::SCC::removeIntraSCCEdge(Node &CallerN,
// First remove it from the node.
CallerN.removeEdgeInternal(CalleeN.getFunction());
- // We return a list of the resulting SCCs, where 'this' is always the first
- // element.
+ // We return a list of the resulting *new* SCCs in postorder.
SmallVector<SCC *, 1> ResultSCCs;
- ResultSCCs.push_back(this);
// Direct recursion doesn't impact the SCC graph at all.
if (&CallerN == &CalleeN)
@@ -337,7 +335,7 @@ LazyCallGraph::SCC::removeIntraSCCEdge(Node &CallerN,
}
}
#ifndef NDEBUG
- if (ResultSCCs.size() > 1)
+ if (!ResultSCCs.empty())
assert(!IsLeafSCC && "This SCC cannot be a leaf as we have split out new "
"SCCs by removing this edge.");
if (!std::any_of(G->LeafSCCs.begin(), G->LeafSCCs.end(),
@@ -347,7 +345,7 @@ LazyCallGraph::SCC::removeIntraSCCEdge(Node &CallerN,
#endif
// If this SCC stopped being a leaf through this edge removal, remove it from
// the leaf SCC list.
- if (!IsLeafSCC && ResultSCCs.size() > 1)
+ if (!IsLeafSCC && !ResultSCCs.empty())
G->LeafSCCs.erase(std::remove(G->LeafSCCs.begin(), G->LeafSCCs.end(), this),
G->LeafSCCs.end());