summaryrefslogtreecommitdiff
path: root/compiler/optimizing/ssa_phi_elimination.cc
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2015-01-23 10:39:45 +0000
committer David Brazdil <dbrazdil@google.com> 2015-01-26 16:13:57 +0000
commited59619b370ef23ffbb25d1d01f615e60a9262b6 (patch)
tree6c93bb6ceff95f7aaf232825e050eecc05c7282d /compiler/optimizing/ssa_phi_elimination.cc
parentf90eec005997f98c1a9f874fbbf68414e5f9c766 (diff)
Optimizing: Speed up HEnvironment use removal
Removal of use records from HEnvironment vregs involved iterating over potentially large linked lists which made compilation of huge methods very slow. This patch turns use lists into doubly-linked lists, stores pointers to the relevant nodes inside HEnvironment and subsequently turns the removals into constant-time operations. Change-Id: I0e1d4d782fd624e7b8075af75d4adf0a0634a1ee
Diffstat (limited to 'compiler/optimizing/ssa_phi_elimination.cc')
-rw-r--r--compiler/optimizing/ssa_phi_elimination.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc
index 58cea771b9..fd30c1bc76 100644
--- a/compiler/optimizing/ssa_phi_elimination.cc
+++ b/compiler/optimizing/ssa_phi_elimination.cc
@@ -26,8 +26,8 @@ void SsaDeadPhiElimination::Run() {
HPhi* phi = inst_it.Current()->AsPhi();
// 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();
+ 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_.Add(phi);
@@ -61,9 +61,9 @@ void SsaDeadPhiElimination::Run() {
next = current->GetNext();
if (current->AsPhi()->IsDead()) {
if (current->HasUses()) {
- for (HUseIterator<HInstruction> use_it(current->GetUses()); !use_it.Done();
+ for (HUseIterator<HInstruction*> use_it(current->GetUses()); !use_it.Done();
use_it.Advance()) {
- HUseListNode<HInstruction>* user_node = use_it.Current();
+ HUseListNode<HInstruction*>* user_node = use_it.Current();
HInstruction* user = user_node->GetUser();
DCHECK(user->IsLoopHeaderPhi()) << user->GetId();
DCHECK(user->AsPhi()->IsDead()) << user->GetId();
@@ -73,12 +73,12 @@ void SsaDeadPhiElimination::Run() {
}
}
if (current->HasEnvironmentUses()) {
- for (HUseIterator<HEnvironment> use_it(current->GetEnvUses()); !use_it.Done();
+ for (HUseIterator<HEnvironment*> use_it(current->GetEnvUses()); !use_it.Done();
use_it.Advance()) {
- HUseListNode<HEnvironment>* user_node = use_it.Current();
+ HUseListNode<HEnvironment*>* user_node = use_it.Current();
HEnvironment* user = user_node->GetUser();
user->SetRawEnvAt(user_node->GetIndex(), nullptr);
- current->RemoveEnvironmentUser(user, user_node->GetIndex());
+ current->RemoveEnvironmentUser(user_node);
}
}
block->RemovePhi(current->AsPhi());
@@ -132,8 +132,8 @@ void SsaRedundantPhiElimination::Run() {
// Because we're updating the users of this phi, we may have new
// phis candidate for elimination if this phi is in a loop. Add phis that
// used this phi to the worklist.
- for (HUseIterator<HInstruction> it(phi->GetUses()); !it.Done(); it.Advance()) {
- HUseListNode<HInstruction>* current = it.Current();
+ for (HUseIterator<HInstruction*> it(phi->GetUses()); !it.Done(); it.Advance()) {
+ HUseListNode<HInstruction*>* current = it.Current();
HInstruction* user = current->GetUser();
if (user->IsPhi()) {
worklist_.Add(user->AsPhi());