summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Analysis/LazyCallGraphTest.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-04-27 01:59:50 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-04-27 01:59:50 +0000
commitaa839b22c9f026ded9979ab428f60d567fc5b361 (patch)
treeae7d61b58177221d99a333e3dbceb005eebd3e88 /llvm/unittests/Analysis/LazyCallGraphTest.cpp
parentda4841b3a90c19de590e99cb130f9dcc6babc970 (diff)
downloadbcm5719-llvm-aa839b22c9f026ded9979ab428f60d567fc5b361.tar.gz
bcm5719-llvm-aa839b22c9f026ded9979ab428f60d567fc5b361.zip
[LCG] Re-organize the methods for mutating a call graph to make their
API requirements much more obvious. The key here is that there are two totally different use cases for mutating the graph. Prior to doing any SCC formation, it is very easy to mutate the graph. There may be users that want to do small tweaks here, and then use the already-built graph for their SCC-based operations. This method remains on the graph itself and is documented carefully as being cheap but unavailable once SCCs are formed. Once SCCs are formed, and there is some in-flight DFS building them, we have to be much more careful in how we mutate the graph. These mutation operations are sunk onto the SCCs themselves, which both simplifies things (the code was already there!) and helps make it obvious that these interfaces are only applicable within that context. The other primary constraint is that the edge being mutated is actually related to the SCC on which we call the method. This helps make it obvious that you cannot arbitrarily mutate some other SCC. I've tried to write much more complete documentation for the interesting mutation API -- intra-SCC edge removal. Currently one aspect of this documentation is a lie (the result list of SCCs) but we also don't even have tests for that API. =[ I'm going to add tests and fix it to match the documentation next. llvm-svn: 207339
Diffstat (limited to 'llvm/unittests/Analysis/LazyCallGraphTest.cpp')
-rw-r--r--llvm/unittests/Analysis/LazyCallGraphTest.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/unittests/Analysis/LazyCallGraphTest.cpp b/llvm/unittests/Analysis/LazyCallGraphTest.cpp
index 058027f2e12..dd66c5cf3a8 100644
--- a/llvm/unittests/Analysis/LazyCallGraphTest.cpp
+++ b/llvm/unittests/Analysis/LazyCallGraphTest.cpp
@@ -331,7 +331,7 @@ TEST(LazyCallGraphTest, InterSCCEdgeRemoval) {
EXPECT_EQ(B.end(), B.begin());
EXPECT_EQ(&AC, &*BC.parent_begin());
- CG.removeEdge(A, lookupFunction(*M, "b"));
+ AC.removeInterSCCEdge(A, B);
EXPECT_EQ(A.end(), A.begin());
EXPECT_EQ(B.end(), B.begin());
@@ -378,14 +378,14 @@ TEST(LazyCallGraphTest, IntraSCCEdgeRemoval) {
// Remove the edge from b -> a, which should leave the 3 functions still in
// a single connected component because of a -> b -> c -> a.
- CG1.removeEdge(B, A.getFunction());
+ SCC.removeIntraSCCEdge(B, A);
EXPECT_EQ(&SCC, CG1.lookupSCC(A));
EXPECT_EQ(&SCC, CG1.lookupSCC(B));
EXPECT_EQ(&SCC, CG1.lookupSCC(C));
// Remove the edge from c -> a, which should leave 'a' in the original SCC
// and form a new SCC for 'b' and 'c'.
- CG1.removeEdge(C, A.getFunction());
+ SCC.removeIntraSCCEdge(C, A);
EXPECT_EQ(&SCC, CG1.lookupSCC(A));
EXPECT_EQ(1, std::distance(SCC.begin(), SCC.end()));
LazyCallGraph::SCC *SCC2 = CG1.lookupSCC(B);
OpenPOWER on IntegriCloud