diff options
Diffstat (limited to 'compiler/dex/dataflow_iterator-inl.h')
-rw-r--r-- | compiler/dex/dataflow_iterator-inl.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/dex/dataflow_iterator-inl.h b/compiler/dex/dataflow_iterator-inl.h index 83dfc28844..e9402e39e5 100644 --- a/compiler/dex/dataflow_iterator-inl.h +++ b/compiler/dex/dataflow_iterator-inl.h @@ -181,10 +181,16 @@ inline BasicBlock* LoopRepeatingTopologicalSortIterator::Next(bool had_change) { idx_ += 1; BasicBlock* bb = mir_graph_->GetBasicBlock((*block_id_list_)[idx]); DCHECK(bb != nullptr); + if ((*loop_ends_)[idx] != 0u) { + // If bb->visited is false, the loop needs to be processed from scratch. + // Otherwise we mark it as recalculating; for a natural loop we will not + // need to recalculate any block in the loop anyway, and for unnatural + // loops we will recalculate the loop head only if one of its predecessors + // actually changes. + bool recalculating = bb->visited; + loop_head_stack_->push_back(std::make_pair(idx, recalculating)); + } if (!bb->visited) { - if ((*loop_ends_)[idx] != 0u) { - loop_head_stack_->push_back(std::make_pair(idx, false)); // Not recalculating. - } return bb; } } |