Index: test/cctest/compiler/test-scheduler.cc |
diff --git a/test/cctest/compiler/test-scheduler.cc b/test/cctest/compiler/test-scheduler.cc |
index 2a3a1db17ed9c5625782701f36a20fd8f27fa8ad..c5412e09557ee92965e4a1220dd24717dffc1db3 100644 |
--- a/test/cctest/compiler/test-scheduler.cc |
+++ b/test/cctest/compiler/test-scheduler.cc |
@@ -1832,4 +1832,60 @@ TEST(PhisPushedDownToDifferentBranches) { |
ComputeAndVerifySchedule(24, &graph); |
} |
+ |
+TEST(BranchHintTrue) { |
+ HandleAndZoneScope scope; |
+ Graph graph(scope.main_zone()); |
+ CommonOperatorBuilder common(scope.main_zone()); |
+ |
+ Node* start = graph.NewNode(common.Start(1)); |
+ graph.SetStart(start); |
+ |
+ Node* p0 = graph.NewNode(common.Parameter(0), start); |
+ Node* tv = graph.NewNode(common.Int32Constant(6)); |
+ Node* fv = graph.NewNode(common.Int32Constant(7)); |
+ Node* br = graph.NewNode(common.Branch(BranchHint::kTrue), p0, start); |
+ Node* t = graph.NewNode(common.IfTrue(), br); |
+ Node* f = graph.NewNode(common.IfFalse(), br); |
+ Node* m = graph.NewNode(common.Merge(2), t, f); |
+ Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 2), tv, fv, m); |
+ Node* ret = graph.NewNode(common.Return(), phi, start, start); |
+ Node* end = graph.NewNode(common.End(), ret, start); |
+ |
+ graph.SetEnd(end); |
+ |
+ Schedule* schedule = ComputeAndVerifySchedule(13, &graph); |
+ // Make sure the false block is marked as deferred. |
+ CHECK(!schedule->block(t)->deferred()); |
+ CHECK(schedule->block(f)->deferred()); |
+} |
+ |
+ |
+TEST(BranchHintFalse) { |
+ HandleAndZoneScope scope; |
+ Graph graph(scope.main_zone()); |
+ CommonOperatorBuilder common(scope.main_zone()); |
+ |
+ Node* start = graph.NewNode(common.Start(1)); |
+ graph.SetStart(start); |
+ |
+ Node* p0 = graph.NewNode(common.Parameter(0), start); |
+ Node* tv = graph.NewNode(common.Int32Constant(6)); |
+ Node* fv = graph.NewNode(common.Int32Constant(7)); |
+ Node* br = graph.NewNode(common.Branch(BranchHint::kFalse), p0, start); |
+ Node* t = graph.NewNode(common.IfTrue(), br); |
+ Node* f = graph.NewNode(common.IfFalse(), br); |
+ Node* m = graph.NewNode(common.Merge(2), t, f); |
+ Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 2), tv, fv, m); |
+ Node* ret = graph.NewNode(common.Return(), phi, start, start); |
+ Node* end = graph.NewNode(common.End(), ret, start); |
+ |
+ graph.SetEnd(end); |
+ |
+ Schedule* schedule = ComputeAndVerifySchedule(13, &graph); |
+ // Make sure the true block is marked as deferred. |
+ CHECK(schedule->block(t)->deferred()); |
+ CHECK(!schedule->block(f)->deferred()); |
+} |
+ |
#endif |