diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/graph_checker.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/nodes.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 7 |
3 files changed, 11 insertions, 6 deletions
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc index 9f4029785a..743ffc46bf 100644 --- a/compiler/optimizing/graph_checker.cc +++ b/compiler/optimizing/graph_checker.cc @@ -268,7 +268,7 @@ void SSAChecker::VisitInstruction(HInstruction* instruction) { for (HUseIterator<HInstruction> use_it(instruction->GetUses()); !use_it.Done(); use_it.Advance()) { HInstruction* use = use_it.Current()->GetUser(); - if (!use->IsPhi() && !instruction->Dominates(use)) { + if (!use->IsPhi() && !instruction->StrictlyDominates(use)) { std::stringstream error; error << "Instruction " << instruction->GetId() << " in block " << current_block_->GetBlockId() @@ -285,7 +285,7 @@ void SSAChecker::VisitInstruction(HInstruction* instruction) { for (size_t i = 0, e = environment->Size(); i < e; ++i) { HInstruction* env_instruction = environment->GetInstructionAt(i); if (env_instruction != nullptr - && !env_instruction->Dominates(instruction)) { + && !env_instruction->StrictlyDominates(instruction)) { std::stringstream error; error << "Instruction " << env_instruction->GetId() << " in environment of instruction " << instruction->GetId() diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index aee21770b7..10c60140ec 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -472,7 +472,11 @@ bool HInstructionList::FoundBefore(const HInstruction* instruction1, return true; } -bool HInstruction::Dominates(HInstruction* other_instruction) const { +bool HInstruction::StrictlyDominates(HInstruction* other_instruction) const { + if (other_instruction == this) { + // An instruction does not strictly dominate itself. + return false; + } HBasicBlock* block = GetBlock(); HBasicBlock* other_block = other_instruction->GetBlock(); if (block != other_block) { diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index ec26c4a4dc..7bb71b6012 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -684,9 +684,10 @@ class HInstruction : public ArenaObject { return result; } - // Does this instruction dominate `other_instruction`? Aborts if - // this instruction and `other_instruction` are both phis. - bool Dominates(HInstruction* other_instruction) const; + // Does this instruction strictly dominate `other_instruction`? + // Returns false if this instruction and `other_instruction` are the same. + // Aborts if this instruction and `other_instruction` are both phis. + bool StrictlyDominates(HInstruction* other_instruction) const; int GetId() const { return id_; } void SetId(int id) { id_ = id; } |