From 2c45bc9137c29f886e69923535aff31a74d90829 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 25 Oct 2016 16:54:12 +0100 Subject: Remove H[Reverse]PostOrderIterator and HInsertionOrderIterator. Use range-based loops instead, introducing helper functions ReverseRange() for iteration in reverse order in containers. When the contents of the underlying container change inside the loop, use an index-based loop that better exposes the container data modifications, compared to the old iterator interface that's hiding it which may lead to subtle bugs. Test: m test-art-host Change-Id: I2a4e6c508b854c37a697fc4b1e8423a8c92c5ea0 --- compiler/optimizing/linear_order.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'compiler/optimizing/linear_order.cc') diff --git a/compiler/optimizing/linear_order.cc b/compiler/optimizing/linear_order.cc index 3af212fa48..80cecd41dc 100644 --- a/compiler/optimizing/linear_order.cc +++ b/compiler/optimizing/linear_order.cc @@ -94,8 +94,7 @@ void LinearizeGraph(const HGraph* graph, // for it. ArenaVector forward_predecessors(graph->GetBlocks().size(), allocator->Adapter(kArenaAllocLinearOrder)); - for (HReversePostOrderIterator it(*graph); !it.Done(); it.Advance()) { - HBasicBlock* block = it.Current(); + for (HBasicBlock* block : graph->GetReversePostOrder()) { size_t number_of_forward_predecessors = block->GetPredecessors().size(); if (block->IsLoopHeader()) { number_of_forward_predecessors -= block->GetLoopInformation()->NumberOfBackEdges(); -- cgit v1.2.3-59-g8ed1b