Lines Matching +full:b2c +full:- +full:test
1 //===- LazyCallGraphTest.cpp - Unit tests for the lazy CG analysis --------===//
8 //===----------------------------------------------------------------------===//
33 // A failure here means that the test itself is buggy. in parseAssembly()
41 IR forming a call graph with a diamond of triangle-shaped SCCs:
45 d3--d2
49 b3--b2 c3--c2
53 a3--a2
123 TEST(LazyCallGraphTest, BasicGraphFormation) { in TEST() function
132 LazyCallGraph::Node &A1 = (I++)->getNode(CG); in TEST()
134 LazyCallGraph::Node &A2 = (I++)->getNode(CG); in TEST()
136 LazyCallGraph::Node &A3 = (I++)->getNode(CG); in TEST()
138 LazyCallGraph::Node &B1 = (I++)->getNode(CG); in TEST()
140 LazyCallGraph::Node &B2 = (I++)->getNode(CG); in TEST()
142 LazyCallGraph::Node &B3 = (I++)->getNode(CG); in TEST()
144 LazyCallGraph::Node &C1 = (I++)->getNode(CG); in TEST()
146 LazyCallGraph::Node &C2 = (I++)->getNode(CG); in TEST()
148 LazyCallGraph::Node &C3 = (I++)->getNode(CG); in TEST()
150 LazyCallGraph::Node &D1 = (I++)->getNode(CG); in TEST()
152 LazyCallGraph::Node &D2 = (I++)->getNode(CG); in TEST()
154 LazyCallGraph::Node &D3 = (I++)->getNode(CG); in TEST()
171 EXPECT_EQ("a3", A2.begin()->getFunction().getName()); in TEST()
173 EXPECT_EQ("a1", A3.begin()->getFunction().getName()); in TEST()
183 EXPECT_EQ("b3", B2.begin()->getFunction().getName()); in TEST()
185 EXPECT_EQ("b1", B3.begin()->getFunction().getName()); in TEST()
195 EXPECT_EQ("c3", C2.begin()->getFunction().getName()); in TEST()
197 EXPECT_EQ("c1", C3.begin()->getFunction().getName()); in TEST()
200 EXPECT_EQ("d2", D1.begin()->getFunction().getName()); in TEST()
202 EXPECT_EQ("d3", D2.begin()->getFunction().getName()); in TEST()
204 EXPECT_EQ("d1", D3.begin()->getFunction().getName()); in TEST()
283 TEST(LazyCallGraphTest, BasicGraphMutation) { in TEST() function
308 LazyCallGraph::Node &C = B.begin()->getNode(CG); in TEST()
313 EXPECT_EQ(&B, C.begin()->getNode()); in TEST()
317 EXPECT_EQ(&B, C.begin()->getNode()); in TEST()
318 EXPECT_EQ(&C, std::next(C.begin())->getNode()); in TEST()
322 EXPECT_EQ(&C, C.begin()->getNode()); in TEST()
331 TEST(LazyCallGraphTest, InnerSCCFormation) { in TEST() function
350 // Now walk the four SCCs which should be in post-order. in TEST()
395 TEST(LazyCallGraphTest, MultiArmSCC) { in TEST() function
455 TEST(LazyCallGraphTest, OutgoingEdgeMutation) { in TEST() function
579 TEST(LazyCallGraphTest, IncomingEdgeInsertion) { in TEST() function
587 // d3--d2 | in TEST()
591 // b3--b2 c3--c2 | in TEST()
595 // a3--a2 | in TEST()
634 // d3--d2---. | in TEST()
638 // b3--b2 c3--c2 | in TEST()
642 // a3--a2 | in TEST()
650 // And marked the D ref-SCC as no longer valid. in TEST()
673 TEST(LazyCallGraphTest, IncomingEdgeInsertionMidTraversal) { in TEST() function
675 // This is the same fundamental test as the previous, but we perform it in TEST()
717 // And marked the D ref-SCC as no longer valid. in TEST()
750 TEST(LazyCallGraphTest, InternalEdgeMutation) { in TEST() function
804 // The SCCs must be in *post-order* which means successors before in TEST()
812 // Test turning the ref edge from A to C into a call edge. This will form an in TEST()
830 TEST(LazyCallGraphTest, InternalEdgeRemoval) { in TEST() function
832 // A nice fully connected (including self-edges) RefSCC. in TEST()
869 // Remove the edge from b -> a, which should leave the 3 functions still in in TEST()
870 // a single connected component because of a -> b -> c -> a. in TEST()
878 // Remove the edge from c -> a, which should leave 'a' in the original RefSCC in TEST()
889 TEST(LazyCallGraphTest, InternalCallEdgeToRef) { in TEST() function
891 // A nice fully connected (including self-edges) SCC (and RefSCC) in TEST()
930 // Remove the call edge from b -> a to a ref edge, which should leave the in TEST()
931 // 3 functions still in a single connected component because of a -> b -> in TEST()
932 // c -> a. in TEST()
939 // Remove the edge from c -> a, which should leave 'a' in the original SCC in TEST()
949 --J; in TEST()
953 // Remove the edge from c -> b, which should leave 'b' in the original SCC in TEST()
964 --J; in TEST()
966 --J; in TEST()
971 TEST(LazyCallGraphTest, InternalRefEdgeToCall) { in TEST() function
1016 // Check the initial post-order. Note that B and C could be flipped here (and in TEST()
1017 // in our mutation) without changing the nature of this test. in TEST()
1024 // Switch the ref edge from A -> D to a call edge. This should have no in TEST()
1034 // Switch B -> C to a call edge. This doesn't form any new cycles but does in TEST()
1044 // Switch C -> B to a call edge. This forms a cycle and forces merging SCCs. in TEST()
1057 TEST(LazyCallGraphTest, InternalRefEdgeToCallNoCycleInterleaved) { in TEST() function
1059 // Test for having a post-order prior to changing a ref edge to a call edge in TEST()
1129 LazyCallGraph::SCC &B2C = *CG.lookupSCC(B2); in TEST() local
1136 // Several call edges are initially present to force a particual post-order. in TEST()
1137 // Remove them now, leaving an interleaved post-order pattern. in TEST()
1144 // Check the initial post-order. We ensure this order with the extra edges in TEST()
1151 EXPECT_EQ(&B2C, &RC[4]); in TEST()
1156 // Switch C3 -> B1 to a call edge. This doesn't form any new cycles but does in TEST()
1164 EXPECT_EQ(&B2C, &RC[2]); in TEST()
1172 TEST(LazyCallGraphTest, InternalRefEdgeToCallBothPartitionAndMerge) { in TEST() function
1174 // Test for having a postorder where between the source and target are all in TEST()
1184 // a particular post-order. Then we remove the forcing edges and connect in TEST()
1194 // | D | | C-D-E | in TEST()
1264 // Remove the extra edges that were used to force a particular post-order. in TEST()
1268 // Check the initial post-order. We ensure this order with the extra edges in TEST()
1279 // Switch F -> B to a call edge. This merges B, D, and F into a single SCC, in TEST()
1285 // | D | -> B | in TEST()