summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-07-28 14:33:01 +0000
committerDuncan Sands <baldrick@free.fr>2011-07-28 14:33:01 +0000
commit6f7eec12941f61148c2615eafa50b49096fb9e2f (patch)
tree0697da2b3d15e563a5a209f15ad0847c4ab8bc3e /unittests
parent8537e8a9a506a2ca1b7795e8d907982ec2235973 (diff)
downloadllvm-6f7eec12941f61148c2615eafa50b49096fb9e2f.tar.gz
llvm-6f7eec12941f61148c2615eafa50b49096fb9e2f.tar.bz2
llvm-6f7eec12941f61148c2615eafa50b49096fb9e2f.tar.xz
Check an additional property specific to the way LLVM
iterates over SCC's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/SCCIteratorTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/unittests/ADT/SCCIteratorTest.cpp b/unittests/ADT/SCCIteratorTest.cpp
index 8146e28f08..cf0ec014df 100644
--- a/unittests/ADT/SCCIteratorTest.cpp
+++ b/unittests/ADT/SCCIteratorTest.cpp
@@ -322,6 +322,21 @@ TEST(SCCIteratorTest, AllSmallGraphs) {
EXPECT_TRUE(NodesInSomeSCC.Meet(NodesInThisSCC).isEmpty());
NodesInSomeSCC = NodesInSomeSCC.Join(NodesInThisSCC);
+
+ // Check a property that is specific to the LLVM SCC iterator and
+ // guaranteed by it: if a node in SCC S1 has an edge to a node in
+ // SCC S2, then S1 is visited *after* S2. This means that the set
+ // of nodes reachable from this SCC must be contained either in the
+ // union of this SCC and all previously visited SCC's.
+
+ for (unsigned i = 0; i != NUM_NODES; ++i)
+ if (NodesInThisSCC.count(i)) {
+ GT::NodeSubset NodesReachableFromSCC = G.NodesReachableFrom(i);
+ EXPECT_TRUE(NodesReachableFromSCC.isSubsetOf(NodesInSomeSCC));
+ // The result must be the same for all other nodes in this SCC, so
+ // there is no point in checking them.
+ break;
+ }
}
// Finally, check that the nodes in some SCC are exactly those that are