diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-08-02 15:55:43 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-02 15:55:43 +0000 |
commit | d335e7b4d034bc8b69efde641779c6e1cd7bba42 (patch) | |
tree | c9a1d6e5554721cada972251768c63bd023ffca6 /compiler/optimizing/loop_optimization.cc | |
parent | 399492a86198b42fded9ac1f4aa61c82869328eb (diff) | |
parent | 21c7e6fbcabef2f22b467e1e89f4abe1aa43e459 (diff) |
Merge "ART: Fix SimplifyInduction for an instruction with HEnvironment."
Diffstat (limited to 'compiler/optimizing/loop_optimization.cc')
-rw-r--r-- | compiler/optimizing/loop_optimization.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc index 274f065084..0ef7dcdb59 100644 --- a/compiler/optimizing/loop_optimization.cc +++ b/compiler/optimizing/loop_optimization.cc @@ -40,6 +40,8 @@ static void RemoveFromCycle(HInstruction* instruction) { instruction->RemoveAsUserOfAllInputs(); instruction->RemoveEnvironmentUsers(); instruction->GetBlock()->RemoveInstructionOrPhi(instruction, /*ensure_safety=*/ false); + RemoveEnvironmentUses(instruction); + ResetEnvironmentInputRecords(instruction); } // Detect a goto block and sets succ to the single successor. @@ -267,6 +269,21 @@ static HInstruction* Insert(HBasicBlock* block, HInstruction* instruction) { return instruction; } +// Check that instructions from the induction sets are fully removed: have no uses +// and no other instructions use them. +static bool CheckInductionSetFullyRemoved(ArenaSet<HInstruction*>* iset) { + for (HInstruction* instr : *iset) { + if (instr->GetBlock() != nullptr || + !instr->GetUses().empty() || + !instr->GetEnvUses().empty() || + HasEnvironmentUsedByOthers(instr)) { + return false; + } + } + + return true; +} + // // Class methods. // @@ -448,6 +465,9 @@ void HLoopOptimization::SimplifyInduction(LoopNode* node) { for (HInstruction* i : *iset_) { RemoveFromCycle(i); } + + // Check that there are no records of the deleted instructions. + DCHECK(CheckInductionSetFullyRemoved(iset_)); simplified_ = true; } } |