Index: test/cctest/compiler/test-control-reducer.cc |
diff --git a/test/cctest/compiler/test-control-reducer.cc b/test/cctest/compiler/test-control-reducer.cc |
index 2f0cb17172d1cbb5b9ebb0cecc33f9a9e49f4ca5..d2bf776a63da60bc566d899ae26280317744489f 100644 |
--- a/test/cctest/compiler/test-control-reducer.cc |
+++ b/test/cctest/compiler/test-control-reducer.cc |
@@ -143,29 +143,6 @@ class ControlReducerTester : HandleAndZoneScope { |
void ReduceGraph() { ControlReducer::ReduceGraph(main_zone(), &jsgraph); } |
- // Checks one-step reduction of a phi. |
- void ReducePhi(Node* expect, Node* phi) { |
- Node* result = ControlReducer::ReducePhiForTesting(&jsgraph, phi); |
- CHECK_EQ(expect, result); |
- ReducePhiIterative(expect, phi); // iterative should give the same result. |
- } |
- |
- // Checks one-step reduction of a phi. |
- void ReducePhiNonIterative(Node* expect, Node* phi) { |
- Node* result = ControlReducer::ReducePhiForTesting(&jsgraph, phi); |
- CHECK_EQ(expect, result); |
- } |
- |
- void ReducePhiIterative(Node* expect, Node* phi) { |
- p0->ReplaceInput(0, start); // hack: parameters may be trimmed. |
- Node* ret = graph.NewNode(common.Return(), phi, start, start); |
- Node* end = graph.NewNode(common.End(1), ret); |
- graph.SetEnd(end); |
- ControlReducer::ReduceGraph(main_zone(), &jsgraph); |
- CheckInputs(end, ret); |
- CheckInputs(ret, expect, start, start); |
- } |
- |
void ReduceMerge(Node* expect, Node* merge) { |
Node* result = ControlReducer::ReduceMerge(&jsgraph, merge); |
CHECK_EQ(expect, result); |
@@ -313,271 +290,6 @@ struct DeadChecker { |
}; |
-TEST(CReducePhi1) { |
- ControlReducerTester R; |
- |
- R.ReducePhi(R.leaf[0], R.Phi(R.leaf[0])); |
- R.ReducePhi(R.leaf[1], R.Phi(R.leaf[1])); |
- R.ReducePhi(R.leaf[2], R.Phi(R.leaf[2])); |
- R.ReducePhi(R.leaf[3], R.Phi(R.leaf[3])); |
-} |
- |
- |
-TEST(CReducePhi1_dead) { |
- ControlReducerTester R; |
- |
- R.ReducePhi(R.leaf[0], R.Phi(R.leaf[0], R.dead)); |
- R.ReducePhi(R.leaf[1], R.Phi(R.leaf[1], R.dead)); |
- R.ReducePhi(R.leaf[2], R.Phi(R.leaf[2], R.dead)); |
- R.ReducePhi(R.leaf[3], R.Phi(R.leaf[3], R.dead)); |
- |
- R.ReducePhi(R.leaf[0], R.Phi(R.dead, R.leaf[0])); |
- R.ReducePhi(R.leaf[1], R.Phi(R.dead, R.leaf[1])); |
- R.ReducePhi(R.leaf[2], R.Phi(R.dead, R.leaf[2])); |
- R.ReducePhi(R.leaf[3], R.Phi(R.dead, R.leaf[3])); |
-} |
- |
- |
-TEST(CReducePhi1_dead2) { |
- ControlReducerTester R; |
- |
- R.ReducePhi(R.leaf[0], R.Phi(R.leaf[0], R.dead, R.dead)); |
- R.ReducePhi(R.leaf[0], R.Phi(R.dead, R.leaf[0], R.dead)); |
- R.ReducePhi(R.leaf[0], R.Phi(R.dead, R.dead, R.leaf[0])); |
-} |
- |
- |
-TEST(CReducePhi2a) { |
- ControlReducerTester R; |
- |
- for (size_t i = 0; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i]; |
- R.ReducePhi(a, R.Phi(a, a)); |
- } |
-} |
- |
- |
-TEST(CReducePhi2b) { |
- ControlReducerTester R; |
- |
- for (size_t i = 0; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i]; |
- R.ReducePhi(a, R.Phi(R.self, a)); |
- R.ReducePhi(a, R.Phi(a, R.self)); |
- } |
-} |
- |
- |
-TEST(CReducePhi2c) { |
- ControlReducerTester R; |
- |
- for (size_t i = 1; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i], *b = R.leaf[0]; |
- Node* phi1 = R.Phi(b, a); |
- R.ReducePhi(phi1, phi1); |
- |
- Node* phi2 = R.Phi(a, b); |
- R.ReducePhi(phi2, phi2); |
- } |
-} |
- |
- |
-TEST(CReducePhi2_dead) { |
- ControlReducerTester R; |
- |
- for (size_t i = 0; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i]; |
- R.ReducePhi(a, R.Phi(a, a, R.dead)); |
- R.ReducePhi(a, R.Phi(a, R.dead, a)); |
- R.ReducePhi(a, R.Phi(R.dead, a, a)); |
- } |
- |
- for (size_t i = 0; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i]; |
- R.ReducePhi(a, R.Phi(R.self, a)); |
- R.ReducePhi(a, R.Phi(a, R.self)); |
- R.ReducePhi(a, R.Phi(R.self, a, R.dead)); |
- R.ReducePhi(a, R.Phi(a, R.self, R.dead)); |
- } |
- |
- for (size_t i = 1; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i], *b = R.leaf[0]; |
- Node* phi1 = R.Phi(b, a, R.dead); |
- R.ReducePhiNonIterative(phi1, phi1); |
- |
- Node* phi2 = R.Phi(a, b, R.dead); |
- R.ReducePhiNonIterative(phi2, phi2); |
- } |
-} |
- |
- |
-TEST(CReducePhi3) { |
- ControlReducerTester R; |
- |
- for (size_t i = 0; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i]; |
- R.ReducePhi(a, R.Phi(a, a, a)); |
- } |
- |
- for (size_t i = 0; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i]; |
- R.ReducePhi(a, R.Phi(R.self, a, a)); |
- R.ReducePhi(a, R.Phi(a, R.self, a)); |
- R.ReducePhi(a, R.Phi(a, a, R.self)); |
- } |
- |
- for (size_t i = 1; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i], *b = R.leaf[0]; |
- Node* phi1 = R.Phi(b, a, a); |
- R.ReducePhi(phi1, phi1); |
- |
- Node* phi2 = R.Phi(a, b, a); |
- R.ReducePhi(phi2, phi2); |
- |
- Node* phi3 = R.Phi(a, a, b); |
- R.ReducePhi(phi3, phi3); |
- } |
-} |
- |
- |
-TEST(CReducePhi4) { |
- ControlReducerTester R; |
- |
- for (size_t i = 0; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i]; |
- R.ReducePhi(a, R.Phi(a, a, a, a)); |
- } |
- |
- for (size_t i = 0; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i]; |
- R.ReducePhi(a, R.Phi(R.self, a, a, a)); |
- R.ReducePhi(a, R.Phi(a, R.self, a, a)); |
- R.ReducePhi(a, R.Phi(a, a, R.self, a)); |
- R.ReducePhi(a, R.Phi(a, a, a, R.self)); |
- |
- R.ReducePhi(a, R.Phi(R.self, R.self, a, a)); |
- R.ReducePhi(a, R.Phi(a, R.self, R.self, a)); |
- R.ReducePhi(a, R.Phi(a, a, R.self, R.self)); |
- R.ReducePhi(a, R.Phi(R.self, a, a, R.self)); |
- } |
- |
- for (size_t i = 1; i < kNumLeafs; i++) { |
- Node* a = R.leaf[i], *b = R.leaf[0]; |
- Node* phi1 = R.Phi(b, a, a, a); |
- R.ReducePhi(phi1, phi1); |
- |
- Node* phi2 = R.Phi(a, b, a, a); |
- R.ReducePhi(phi2, phi2); |
- |
- Node* phi3 = R.Phi(a, a, b, a); |
- R.ReducePhi(phi3, phi3); |
- |
- Node* phi4 = R.Phi(a, a, a, b); |
- R.ReducePhi(phi4, phi4); |
- } |
-} |
- |
- |
-TEST(CReducePhi_iterative1) { |
- ControlReducerTester R; |
- |
- R.ReducePhiIterative(R.leaf[0], R.Phi(R.leaf[0], R.Phi(R.leaf[0]))); |
- R.ReducePhiIterative(R.leaf[0], R.Phi(R.Phi(R.leaf[0]), R.leaf[0])); |
-} |
- |
- |
-TEST(CReducePhi_iterative2) { |
- ControlReducerTester R; |
- |
- R.ReducePhiIterative(R.leaf[0], R.Phi(R.Phi(R.leaf[0]), R.Phi(R.leaf[0]))); |
-} |
- |
- |
-TEST(CReducePhi_iterative3) { |
- ControlReducerTester R; |
- |
- R.ReducePhiIterative(R.leaf[0], |
- R.Phi(R.leaf[0], R.Phi(R.leaf[0], R.leaf[0]))); |
- R.ReducePhiIterative(R.leaf[0], |
- R.Phi(R.Phi(R.leaf[0], R.leaf[0]), R.leaf[0])); |
-} |
- |
- |
-TEST(CReducePhi_iterative4) { |
- ControlReducerTester R; |
- |
- R.ReducePhiIterative(R.leaf[0], R.Phi(R.Phi(R.leaf[0], R.leaf[0]), |
- R.Phi(R.leaf[0], R.leaf[0]))); |
- |
- Node* p1 = R.Phi(R.leaf[0], R.leaf[0]); |
- R.ReducePhiIterative(R.leaf[0], R.Phi(p1, p1)); |
- |
- Node* p2 = R.Phi(R.leaf[0], R.leaf[0], R.leaf[0]); |
- R.ReducePhiIterative(R.leaf[0], R.Phi(p2, p2, p2)); |
- |
- Node* p3 = R.Phi(R.leaf[0], R.leaf[0], R.leaf[0]); |
- R.ReducePhiIterative(R.leaf[0], R.Phi(p3, p3, R.leaf[0])); |
-} |
- |
- |
-TEST(CReducePhi_iterative_self1) { |
- ControlReducerTester R; |
- |
- R.ReducePhiIterative(R.leaf[0], R.Phi(R.leaf[0], R.Phi(R.leaf[0], R.self))); |
- R.ReducePhiIterative(R.leaf[0], R.Phi(R.Phi(R.leaf[0], R.self), R.leaf[0])); |
-} |
- |
- |
-TEST(CReducePhi_iterative_self2) { |
- ControlReducerTester R; |
- |
- R.ReducePhiIterative( |
- R.leaf[0], R.Phi(R.Phi(R.leaf[0], R.self), R.Phi(R.leaf[0], R.self))); |
- R.ReducePhiIterative( |
- R.leaf[0], R.Phi(R.Phi(R.self, R.leaf[0]), R.Phi(R.self, R.leaf[0]))); |
- |
- Node* p1 = R.Phi(R.leaf[0], R.self); |
- R.ReducePhiIterative(R.leaf[0], R.Phi(p1, p1)); |
- |
- Node* p2 = R.Phi(R.self, R.leaf[0]); |
- R.ReducePhiIterative(R.leaf[0], R.Phi(p2, p2)); |
-} |
- |
- |
-TEST(EReducePhi1) { |
- ControlReducerTester R; |
- |
- R.ReducePhi(R.leaf[0], R.EffectPhi(R.leaf[0])); |
- R.ReducePhi(R.leaf[1], R.EffectPhi(R.leaf[1])); |
- R.ReducePhi(R.leaf[2], R.EffectPhi(R.leaf[2])); |
- R.ReducePhi(R.leaf[3], R.EffectPhi(R.leaf[3])); |
-} |
- |
- |
-TEST(EReducePhi1_dead) { |
- ControlReducerTester R; |
- |
- R.ReducePhi(R.leaf[0], R.EffectPhi(R.leaf[0], R.dead)); |
- R.ReducePhi(R.leaf[1], R.EffectPhi(R.leaf[1], R.dead)); |
- R.ReducePhi(R.leaf[2], R.EffectPhi(R.leaf[2], R.dead)); |
- R.ReducePhi(R.leaf[3], R.EffectPhi(R.leaf[3], R.dead)); |
- |
- R.ReducePhi(R.leaf[0], R.EffectPhi(R.dead, R.leaf[0])); |
- R.ReducePhi(R.leaf[1], R.EffectPhi(R.dead, R.leaf[1])); |
- R.ReducePhi(R.leaf[2], R.EffectPhi(R.dead, R.leaf[2])); |
- R.ReducePhi(R.leaf[3], R.EffectPhi(R.dead, R.leaf[3])); |
-} |
- |
- |
-TEST(EReducePhi1_dead2) { |
- ControlReducerTester R; |
- |
- R.ReducePhi(R.leaf[0], R.EffectPhi(R.leaf[0], R.dead, R.dead)); |
- R.ReducePhi(R.leaf[0], R.EffectPhi(R.dead, R.leaf[0], R.dead)); |
- R.ReducePhi(R.leaf[0], R.EffectPhi(R.dead, R.dead, R.leaf[0])); |
-} |
- |
- |
TEST(CMergeReduce_simple1) { |
ControlReducerTester R; |
@@ -982,17 +694,6 @@ TEST(CChainedDiamondsReduce_phi1) { |
} |
-TEST(CChainedDiamondsReduce_phi2) { |
- ControlReducerTester R; |
- Diamond d1(R, R.p0, R.jsgraph.TrueConstant(), |
- R.jsgraph.TrueConstant()); // redundant phi. |
- Diamond d2(R, d1.phi); |
- d2.chain(d1); |
- |
- R.ReduceMergeIterative(d1.merge, d2.merge); |
-} |
- |
- |
TEST(CNestedDiamondsReduce_true_true_false) { |
ControlReducerTester R; |
Diamond d1(R, R.jsgraph.TrueConstant()); |