summaryrefslogtreecommitdiff
path: root/compiler/optimizing/ssa_phi_elimination.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-06-03 12:34:22 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-06-03 12:34:23 +0000
commit4248fc46289f9940aa13d22e4f89abed5e74b169 (patch)
treeaa72b1443c7ed4ff86eb96468c56071df30c89b8 /compiler/optimizing/ssa_phi_elimination.cc
parentf3349b5cc7baa06bdc82d3f55e8e57a7e266b809 (diff)
parent372f10e5b0b34e2bb6e2b79aeba6c441e14afd1f (diff)
Merge "Refactor handling of input records."
Diffstat (limited to 'compiler/optimizing/ssa_phi_elimination.cc')
-rw-r--r--compiler/optimizing/ssa_phi_elimination.cc14
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()) {