Commit df19854c authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[cleanup] Introduce IsMarked() predicate to ScheduleLateNodeVisitor

R=jarin@chromium.org

Change-Id: Ia585398db7e9c69283450def924bc10edc37448f
Reviewed-on: https://chromium-review.googlesource.com/c/1335563Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57522}
parent e734cc6e
......@@ -1443,13 +1443,19 @@ class ScheduleLateNodeVisitor {
}
}
bool IsMarked(BasicBlock* block) const {
DCHECK_LT(block->id().ToSize(), marked_.size());
return marked_[block->id().ToSize()];
}
void Mark(BasicBlock* block) { marked_[block->id().ToSize()] = true; }
// Mark {block} and push its non-marked predecessor on the marking queue.
void MarkBlock(BasicBlock* block) {
DCHECK_LT(block->id().ToSize(), marked_.size());
marked_[block->id().ToSize()] = true;
Mark(block);
for (BasicBlock* pred_block : block->predecessors()) {
DCHECK_LT(pred_block->id().ToSize(), marked_.size());
if (marked_[pred_block->id().ToSize()]) continue;
if (IsMarked(pred_block)) continue;
marking_queue_.push_back(pred_block);
}
}
......@@ -1474,7 +1480,7 @@ class ScheduleLateNodeVisitor {
for (Edge edge : node->use_edges()) {
if (!scheduler_->IsLive(edge.from())) continue;
BasicBlock* use_block = GetBlockForUse(edge);
if (use_block == nullptr || marked_[use_block->id().ToSize()]) continue;
if (use_block == nullptr || IsMarked(use_block)) continue;
if (use_block == block) {
TRACE(" not splitting #%d:%s, it is used in id:%d\n", node->id(),
node->op()->mnemonic(), block->id().ToInt());
......@@ -1489,10 +1495,10 @@ class ScheduleLateNodeVisitor {
do {
BasicBlock* top_block = marking_queue_.front();
marking_queue_.pop_front();
if (marked_[top_block->id().ToSize()]) continue;
if (IsMarked(top_block)) continue;
bool marked = true;
for (BasicBlock* successor : top_block->successors()) {
if (!marked_[successor->id().ToSize()]) {
if (!IsMarked(successor)) {
marked = false;
break;
}
......@@ -1503,7 +1509,7 @@ class ScheduleLateNodeVisitor {
// If the (common dominator) {block} is marked, we know that all paths from
// {block} to the end contain at least one use of {node}, and hence there's
// no point in splitting the {node} in this case.
if (marked_[block->id().ToSize()]) {
if (IsMarked(block)) {
TRACE(" not splitting #%d:%s, its common dominator id:%d is perfect\n",
node->id(), node->op()->mnemonic(), block->id().ToInt());
return block;
......@@ -1518,7 +1524,7 @@ class ScheduleLateNodeVisitor {
if (!scheduler_->IsLive(edge.from())) continue;
BasicBlock* use_block = GetBlockForUse(edge);
if (use_block == nullptr) continue;
while (marked_[use_block->dominator()->id().ToSize()]) {
while (IsMarked(use_block)) {
use_block = use_block->dominator();
}
auto& use_node = dominators[use_block];
......
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