diff options
author | 2017-08-10 19:42:31 +0000 | |
---|---|---|
committer | 2017-08-10 19:42:31 +0000 | |
commit | 73de4a8f0936bfb8b74db0465f277a2b68d16905 (patch) | |
tree | 76ad27c460c92ea15cc6a55ce1d770d7b58ef3a8 /compiler/optimizing | |
parent | 461ec567f16039374dff35e2f3b808986c100249 (diff) | |
parent | 671e48a4895cc1a0b7a1458d608f8c4f9b5cf85c (diff) |
Merge "Fix performance regression."
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/loop_optimization.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc index 4143462c71..027ba7741c 100644 --- a/compiler/optimizing/loop_optimization.cc +++ b/compiler/optimizing/loop_optimization.cc @@ -490,13 +490,18 @@ void HLoopOptimization::SimplifyInduction(LoopNode* node) { for (HInstructionIterator it(header->GetPhis()); !it.Done(); it.Advance()) { HPhi* phi = it.Current()->AsPhi(); if (TrySetPhiInduction(phi, /*restrict_uses*/ true) && - CanRemoveCycle() && TryAssignLastValue(node->loop_info, phi, preheader, /*collect_loop_uses*/ false)) { - simplified_ = true; - for (HInstruction* i : *iset_) { - RemoveFromCycle(i); + // Note that it's ok to have replaced uses after the loop with the last value, without + // being able to remove the cycle. Environment uses (which are the reason we may not be + // able to remove the cycle) within the loop will still hold the right value. We must + // have tried first, however, to replace outside uses. + if (CanRemoveCycle()) { + simplified_ = true; + for (HInstruction* i : *iset_) { + RemoveFromCycle(i); + } + DCHECK(CheckInductionSetFullyRemoved(iset_)); } - DCHECK(CheckInductionSetFullyRemoved(iset_)); } } } |