| Index: test/unittests/compiler/control-flow-optimizer-unittest.cc
|
| diff --git a/test/unittests/compiler/control-flow-optimizer-unittest.cc b/test/unittests/compiler/control-flow-optimizer-unittest.cc
|
| index c083d4bab5c62afd6c2e23e7f2c659a3e69bf10e..f5c182934ba08ec5d481928c93d8dd0622125622 100644
|
| --- a/test/unittests/compiler/control-flow-optimizer-unittest.cc
|
| +++ b/test/unittests/compiler/control-flow-optimizer-unittest.cc
|
| @@ -39,7 +39,7 @@ class ControlFlowOptimizerTest : public GraphTest {
|
| };
|
|
|
|
|
| -TEST_F(ControlFlowOptimizerTest, Switch) {
|
| +TEST_F(ControlFlowOptimizerTest, BuildSwitch) {
|
| Node* index = Parameter(0);
|
| Node* branch0 = graph()->NewNode(
|
| common()->Branch(),
|
| @@ -65,6 +65,34 @@ TEST_F(ControlFlowOptimizerTest, Switch) {
|
| IsSwitch(index, start()))))));
|
| }
|
|
|
| +
|
| +TEST_F(ControlFlowOptimizerTest, CloneBranch) {
|
| + Node* cond0 = Parameter(0);
|
| + Node* cond1 = Parameter(1);
|
| + Node* cond2 = Parameter(2);
|
| + Node* branch0 = graph()->NewNode(common()->Branch(), cond0, start());
|
| + Node* control1 = graph()->NewNode(common()->IfTrue(), branch0);
|
| + Node* control2 = graph()->NewNode(common()->IfFalse(), branch0);
|
| + Node* merge0 = graph()->NewNode(common()->Merge(2), control1, control2);
|
| + Node* phi0 =
|
| + graph()->NewNode(common()->Phi(kRepBit, 2), cond1, cond2, merge0);
|
| + Node* branch = graph()->NewNode(common()->Branch(), phi0, merge0);
|
| + Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
|
| + Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
| + Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
| + graph()->SetEnd(graph()->NewNode(common()->End(), merge));
|
| + Optimize();
|
| + Capture<Node*> branch1_capture, branch2_capture;
|
| + EXPECT_THAT(
|
| + end(),
|
| + IsEnd(IsMerge(IsMerge(IsIfTrue(CaptureEq(&branch1_capture)),
|
| + IsIfTrue(CaptureEq(&branch2_capture))),
|
| + IsMerge(IsIfFalse(AllOf(CaptureEq(&branch1_capture),
|
| + IsBranch(cond1, control1))),
|
| + IsIfFalse(AllOf(CaptureEq(&branch2_capture),
|
| + IsBranch(cond2, control2)))))));
|
| +}
|
| +
|
| } // namespace compiler
|
| } // namespace internal
|
| } // namespace v8
|
|
|