Fix scheduler for floating non-naked non-empty loops.

R=jarin@chromium.org
TEST=cctest/test-scheduler/NestedFloatingDiamondWithLoop

Review URL: https://codereview.chromium.org/709753002

Cr-Commit-Position: refs/heads/master@{#25283}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25283 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ebbcbf16
......@@ -295,6 +295,9 @@ class CFGBuilder {
}
private:
// TODO(mstarzinger): Only for Scheduler::FuseFloatingControl.
friend class Scheduler;
void FixNode(BasicBlock* block, Node* node) {
schedule_->AddNode(block, node);
scheduler_->UpdatePlacement(node, Scheduler::kFixed);
......@@ -1158,7 +1161,6 @@ class ScheduleEarlyNodeVisitor {
// Fixed nodes already know their schedule early position.
if (scheduler_->GetPlacement(node) == Scheduler::kFixed) {
DCHECK_EQ(schedule_->start(), data->minimum_block_);
data->minimum_block_ = schedule_->block(node);
Trace("Fixing #%d:%s minimum_block = B%d, dominator_depth = %d\n",
node->id(), node->op()->mnemonic(),
......@@ -1450,6 +1452,29 @@ void Scheduler::FuseFloatingControl(BasicBlock* block, Node* node) {
}
GenerateImmediateDominatorTree();
// Iterate on phase 4: Schedule nodes early.
// TODO(mstarzinger): The following loop gathering the propagation roots is a
// temporary solution and should be merged into the rest of the scheduler as
// soon as the approach settled for all floating loops.
NodeVector propagation_roots(cfg_builder.control_);
for (Node* node : cfg_builder.control_) {
for (Node* use : node->uses()) {
if (use->opcode() == IrOpcode::kPhi ||
use->opcode() == IrOpcode::kEffectPhi) {
propagation_roots.push_back(use);
}
}
}
if (FLAG_trace_turbo_scheduler) {
Trace("propagation roots: ");
for (Node* node : propagation_roots) {
Trace("#%d:%s ", node->id(), node->op()->mnemonic());
}
Trace("\n");
}
ScheduleEarlyNodeVisitor schedule_early_visitor(zone_, this);
schedule_early_visitor.Run(&propagation_roots);
// Move previously planned nodes.
// TODO(mstarzinger): Improve that by supporting bulk moves.
scheduled_nodes_.resize(schedule_->BasicBlockCount(), NodeVector(zone_));
......
......@@ -1825,10 +1825,8 @@ TEST(NestedFloatingDiamondWithLoop) {
Node* loop = graph.NewNode(common.Loop(2), f, start);
Node* ind = graph.NewNode(common.Phi(kMachAnyTagged, 2), p0, p0, loop);
// TODO(mstarzinger): Make scheduler deal with non-empty loops here.
// Node* add = graph.NewNode(&kIntAdd, ind, fv);
Node* br1 = graph.NewNode(common.Branch(), ind, loop);
Node* add = graph.NewNode(&kIntAdd, ind, fv);
Node* br1 = graph.NewNode(common.Branch(), add, loop);
Node* t1 = graph.NewNode(common.IfTrue(), br1);
Node* f1 = graph.NewNode(common.IfFalse(), br1);
......@@ -1843,7 +1841,7 @@ TEST(NestedFloatingDiamondWithLoop) {
graph.SetEnd(end);
ComputeAndVerifySchedule(19, &graph);
ComputeAndVerifySchedule(20, &graph);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment