summaryrefslogtreecommitdiff
path: root/unittests/Analysis
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
commite3a8e534e15ea54ed7e634550573a9572976cc44 (patch)
treeea11ebda572e7fc4081bbfb58b694d25ed1f1f50 /unittests/Analysis
parenteb3430cfbde7c28586a0d55cff8a88dbb3aa348f (diff)
downloadllvm-e3a8e534e15ea54ed7e634550573a9572976cc44.tar.gz
llvm-e3a8e534e15ea54ed7e634550573a9572976cc44.tar.bz2
llvm-e3a8e534e15ea54ed7e634550573a9572976cc44.tar.xz
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207339 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Analysis')
-rw-r--r--unittests/Analysis/LazyCallGraphTest.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/unittests/Analysis/LazyCallGraphTest.cpp b/unittests/Analysis/LazyCallGraphTest.cpp
index 058027f2e1..dd66c5cf3a 100644
--- a/unittests/Analysis/LazyCallGraphTest.cpp
+++ b/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);