diff options
| author | Vladimir Marko <vmarko@google.com> | 2016-05-10 15:23:37 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2016-05-10 15:23:37 +0000 |
| commit | 2e98af80df2f32a4ea6f4070190219e02549723c (patch) | |
| tree | f34f0fa4c714f59ac87a57c102d7a277cd0376ab | |
| parent | 1a19752a2c00f72838fc6c7b2b5310c229288451 (diff) | |
| parent | 63347bbb6d25b762eaa67c67d78a019d28e94321 (diff) | |
Reduce memory usage of SSA Phi elimination and make it faster.
am: 63347bbb6d
* commit '63347bbb6d25b762eaa67c67d78a019d28e94321':
Reduce memory usage of SSA Phi elimination and make it faster.
Change-Id: Ic69aa062c0e985440a28d92cfafabbaa300ef847
| -rw-r--r-- | compiler/optimizing/ssa_phi_elimination.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc index 44bcadf8466..c67612e651f 100644 --- a/compiler/optimizing/ssa_phi_elimination.cc +++ b/compiler/optimizing/ssa_phi_elimination.cc @@ -17,6 +17,7 @@ #include "ssa_phi_elimination.h" #include "base/arena_containers.h" +#include "base/arena_bit_vector.h" #include "base/bit_vector-inl.h" namespace art { @@ -127,8 +128,10 @@ void SsaRedundantPhiElimination::Run() { } } - ArenaSet<uint32_t> visited_phis_in_cycle( - graph_->GetArena()->Adapter(kArenaAllocSsaPhiElimination)); + ArenaBitVector visited_phis_in_cycle(graph_->GetArena(), + graph_->GetCurrentInstructionId(), + /* expandable */ false, + kArenaAllocSsaPhiElimination); ArenaVector<HPhi*> cycle_worklist(graph_->GetArena()->Adapter(kArenaAllocSsaPhiElimination)); while (!worklist_.empty()) { @@ -147,11 +150,11 @@ void SsaRedundantPhiElimination::Run() { } HInstruction* candidate = nullptr; - visited_phis_in_cycle.clear(); + visited_phis_in_cycle.ClearAllBits(); cycle_worklist.clear(); cycle_worklist.push_back(phi); - visited_phis_in_cycle.insert(phi->GetId()); + visited_phis_in_cycle.SetBit(phi->GetId()); bool catch_phi_in_cycle = phi->IsCatchPhi(); bool irreducible_loop_phi_in_cycle = phi->IsIrreducibleLoopHeaderPhi(); @@ -183,9 +186,9 @@ void SsaRedundantPhiElimination::Run() { if (input == current) { continue; } else if (input->IsPhi()) { - if (!ContainsElement(visited_phis_in_cycle, input->GetId())) { + if (!visited_phis_in_cycle.IsBitSet(input->GetId())) { cycle_worklist.push_back(input->AsPhi()); - visited_phis_in_cycle.insert(input->GetId()); + visited_phis_in_cycle.SetBit(input->GetId()); catch_phi_in_cycle |= input->AsPhi()->IsCatchPhi(); irreducible_loop_phi_in_cycle |= input->IsIrreducibleLoopHeaderPhi(); } else { @@ -234,7 +237,7 @@ void SsaRedundantPhiElimination::Run() { // for elimination. Add phis that use this phi to the worklist. for (const HUseListNode<HInstruction*>& use : current->GetUses()) { HInstruction* user = use.GetUser(); - if (user->IsPhi() && !ContainsElement(visited_phis_in_cycle, user->GetId())) { + if (user->IsPhi() && !visited_phis_in_cycle.IsBitSet(user->GetId())) { worklist_.push_back(user->AsPhi()); } } |
