Revert "ART: Implement DeadPhiHandling in PrimitiveTypePropagation"
Crashes on YouTube, need to investigate
This reverts commit 1749e2cfb5c5ed4d6970a09aecf898ca9cdfcb75.
Change-Id: If5f133d55dcc26b8db79a670a48fbd4af7807556
diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc
index c6993f3..72f9ddd 100644
--- a/compiler/optimizing/ssa_phi_elimination.cc
+++ b/compiler/optimizing/ssa_phi_elimination.cc
@@ -29,28 +29,17 @@
HBasicBlock* block = it.Current();
for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) {
HPhi* phi = inst_it.Current()->AsPhi();
- if (phi->IsDead()) {
- // Phis are constructed live so this one was proven conflicting.
- continue;
- }
-
- bool is_live = false;
- if (graph_->IsDebuggable() && phi->HasEnvironmentUses()) {
- is_live = true;
- } else {
- for (HUseIterator<HInstruction*> use_it(phi->GetUses()); !use_it.Done(); use_it.Advance()) {
- if (!use_it.Current()->GetUser()->IsPhi()) {
- is_live = true;
- break;
- }
+ // Set dead ahead of running through uses. The phi may have no use.
+ phi->SetDead();
+ for (HUseIterator<HInstruction*> use_it(phi->GetUses()); !use_it.Done(); use_it.Advance()) {
+ HUseListNode<HInstruction*>* current = use_it.Current();
+ HInstruction* user = current->GetUser();
+ if (!user->IsPhi()) {
+ worklist_.push_back(phi);
+ phi->SetLive();
+ break;
}
}
-
- if (is_live) {
- worklist_.push_back(phi);
- } else {
- phi->SetDead();
- }
}
}
@@ -61,10 +50,8 @@
for (HInputIterator it(phi); !it.Done(); it.Advance()) {
HInstruction* input = it.Current();
if (input->IsPhi() && input->AsPhi()->IsDead()) {
- // If we revive a phi it must have been live at the beginning of
- // the pass but had no non-phi uses of its own.
- input->AsPhi()->SetLive();
worklist_.push_back(input->AsPhi());
+ input->AsPhi()->SetLive();
}
}
}
@@ -88,8 +75,8 @@
for (HUseIterator<HInstruction*> use_it(phi->GetUses()); !use_it.Done();
use_it.Advance()) {
HInstruction* user = use_it.Current()->GetUser();
- DCHECK(user->IsPhi());
- DCHECK(user->AsPhi()->IsDead());
+ DCHECK(user->IsLoopHeaderPhi()) << user->GetId();
+ DCHECK(user->AsPhi()->IsDead()) << user->GetId();
}
}
// Remove the phi from use lists of its inputs.