Start immediate dominator propagation at entry to floating control.
R=titzer@chromium.org Review URL: https://codereview.chromium.org/761673004 Cr-Commit-Position: refs/heads/master@{#25543}
This commit is contained in:
parent
9724ede898
commit
9f1bc698ad
@ -1037,15 +1037,8 @@ void Scheduler::ComputeSpecialRPONumbering() {
|
||||
}
|
||||
|
||||
|
||||
void Scheduler::GenerateImmediateDominatorTree() {
|
||||
Trace("--- IMMEDIATE BLOCK DOMINATORS -----------------------------\n");
|
||||
|
||||
// TODO(danno): Consider using Lengauer & Tarjan's if this becomes too slow.
|
||||
|
||||
// Build the block dominator tree.
|
||||
schedule_->start()->set_dominator_depth(0);
|
||||
BasicBlock* second = schedule_->start()->rpo_next();
|
||||
for (BasicBlock* block = second; block != NULL; block = block->rpo_next()) {
|
||||
void Scheduler::PropagateImmediateDominators(BasicBlock* block) {
|
||||
for (/*nop*/; block != NULL; block = block->rpo_next()) {
|
||||
BasicBlock::Predecessors::iterator pred = block->predecessors_begin();
|
||||
BasicBlock::Predecessors::iterator end = block->predecessors_end();
|
||||
DCHECK(pred != end); // All blocks except start have predecessors.
|
||||
@ -1068,6 +1061,17 @@ void Scheduler::GenerateImmediateDominatorTree() {
|
||||
}
|
||||
|
||||
|
||||
void Scheduler::GenerateImmediateDominatorTree() {
|
||||
Trace("--- IMMEDIATE BLOCK DOMINATORS -----------------------------\n");
|
||||
|
||||
// Seed start block to be the first dominator.
|
||||
schedule_->start()->set_dominator_depth(0);
|
||||
|
||||
// Build the block dominator tree resulting from the above seed.
|
||||
PropagateImmediateDominators(schedule_->start()->rpo_next());
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Phase 3: Prepare use counts for nodes.
|
||||
|
||||
@ -1434,11 +1438,11 @@ void Scheduler::FuseFloatingControl(BasicBlock* block, Node* node) {
|
||||
// Iterate on phase 2: Compute special RPO and dominator tree.
|
||||
special_rpo_->UpdateSpecialRPO(block, schedule_->block(node));
|
||||
// TODO(mstarzinger): Currently "iterate on" means "re-run". Fix that.
|
||||
for (BasicBlock* block : schedule_->all_blocks_) {
|
||||
block->set_dominator_depth(-1);
|
||||
block->set_dominator(NULL);
|
||||
for (BasicBlock* b = block->rpo_next(); b != NULL; b = b->rpo_next()) {
|
||||
b->set_dominator_depth(-1);
|
||||
b->set_dominator(NULL);
|
||||
}
|
||||
GenerateImmediateDominatorTree();
|
||||
PropagateImmediateDominators(block->rpo_next());
|
||||
|
||||
// Iterate on phase 4: Schedule nodes early.
|
||||
// TODO(mstarzinger): The following loop gathering the propagation roots is a
|
||||
|
@ -78,6 +78,7 @@ class Scheduler {
|
||||
void DecrementUnscheduledUseCount(Node* node, int index, Node* from);
|
||||
|
||||
BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2);
|
||||
void PropagateImmediateDominators(BasicBlock* block);
|
||||
|
||||
// Phase 1: Build control-flow graph.
|
||||
friend class CFGBuilder;
|
||||
|
Loading…
Reference in New Issue
Block a user