diff options
author | 2016-10-25 16:54:12 +0100 | |
---|---|---|
committer | 2016-10-27 14:30:29 +0100 | |
commit | 2c45bc9137c29f886e69923535aff31a74d90829 (patch) | |
tree | 90c7762c2dcb1105bf5907d6a1d068f172ea6155 /compiler/optimizing/side_effects_analysis.cc | |
parent | 168c58ce18b139d313cbc6131e3bb43539952c55 (diff) |
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
Diffstat (limited to 'compiler/optimizing/side_effects_analysis.cc')
-rw-r--r-- | compiler/optimizing/side_effects_analysis.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/optimizing/side_effects_analysis.cc b/compiler/optimizing/side_effects_analysis.cc index 1dc69867b4..6d82e8e06d 100644 --- a/compiler/optimizing/side_effects_analysis.cc +++ b/compiler/optimizing/side_effects_analysis.cc @@ -26,8 +26,7 @@ void SideEffectsAnalysis::Run() { // In DEBUG mode, ensure side effects are properly initialized to empty. if (kIsDebugBuild) { - for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) { - HBasicBlock* block = it.Current(); + for (HBasicBlock* block : graph_->GetReversePostOrder()) { SideEffects effects = GetBlockEffects(block); DCHECK(effects.DoesNothing()); if (block->IsLoopHeader()) { @@ -38,9 +37,7 @@ void SideEffectsAnalysis::Run() { } // Do a post order visit to ensure we visit a loop header after its loop body. - for (HPostOrderIterator it(*graph_); !it.Done(); it.Advance()) { - HBasicBlock* block = it.Current(); - + for (HBasicBlock* block : graph_->GetPostOrder()) { SideEffects effects = SideEffects::None(); // Update `effects` with the side effects of all instructions in this block. for (HInstructionIterator inst_it(block->GetInstructions()); !inst_it.Done(); |