diff options
Diffstat (limited to 'compiler/optimizing/ssa_phi_elimination.cc')
-rw-r--r-- | compiler/optimizing/ssa_phi_elimination.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc index c67612e651..b1ec99ab8e 100644 --- a/compiler/optimizing/ssa_phi_elimination.cc +++ b/compiler/optimizing/ssa_phi_elimination.cc @@ -67,8 +67,8 @@ void SsaDeadPhiElimination::MarkDeadPhis() { while (!worklist_.empty()) { HPhi* phi = worklist_.back(); worklist_.pop_back(); - for (HInputIterator it(phi); !it.Done(); it.Advance()) { - HPhi* input = it.Current()->AsPhi(); + for (HInstruction* raw_input : phi->GetInputs()) { + HPhi* input = raw_input->AsPhi(); if (input != nullptr && input->IsDead()) { // Input is a dead phi. Revive it and add to the worklist. We make sure // that the phi was not dead initially (see definition of `initially_live`). @@ -102,9 +102,7 @@ void SsaDeadPhiElimination::EliminateDeadPhis() { } } // Remove the phi from use lists of its inputs. - for (size_t i = 0, e = phi->InputCount(); i < e; ++i) { - phi->RemoveAsUserOfInput(i); - } + phi->RemoveAsUserOfAllInputs(); // Remove the phi from environments that use it. for (const HUseListNode<HEnvironment*>& use : phi->GetEnvUses()) { HEnvironment* user = use.GetUser(); @@ -159,8 +157,7 @@ void SsaRedundantPhiElimination::Run() { bool irreducible_loop_phi_in_cycle = phi->IsIrreducibleLoopHeaderPhi(); // First do a simple loop over inputs and check if they are all the same. - for (size_t j = 0; j < phi->InputCount(); ++j) { - HInstruction* input = phi->InputAt(j); + for (HInstruction* input : phi->GetInputs()) { if (input == phi) { continue; } else if (candidate == nullptr) { @@ -181,8 +178,7 @@ void SsaRedundantPhiElimination::Run() { DCHECK(!current->IsLoopHeaderPhi() || current->GetBlock()->IsLoopPreHeaderFirstPredecessor()); - for (size_t j = 0; j < current->InputCount(); ++j) { - HInstruction* input = current->InputAt(j); + for (HInstruction* input : current->GetInputs()) { if (input == current) { continue; } else if (input->IsPhi()) { |