diff options
Diffstat (limited to 'compiler/optimizing/nodes.cc')
| -rw-r--r-- | compiler/optimizing/nodes.cc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index ade31380ec..39ec22bea1 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -15,6 +15,7 @@ */ #include "nodes.h" + #include "ssa_builder.h" #include "utils/growable_array.h" @@ -456,6 +457,22 @@ static void RemoveFromUseList(T* user, } } +HInstruction* HInstruction::GetNextDisregardingMoves() const { + HInstruction* next = GetNext(); + while (next != nullptr && next->IsParallelMove()) { + next = next->GetNext(); + } + return next; +} + +HInstruction* HInstruction::GetPreviousDisregardingMoves() const { + HInstruction* previous = GetPrevious(); + while (previous != nullptr && previous->IsParallelMove()) { + previous = previous->GetPrevious(); + } + return previous; +} + void HInstruction::RemoveUser(HInstruction* user, size_t input_index) { RemoveFromUseList(user, input_index, &uses_); } @@ -654,11 +671,7 @@ HConstant* HBinaryOperation::TryStaticEvaluation() const { } bool HCondition::IsBeforeWhenDisregardMoves(HIf* if_) const { - HInstruction* previous = if_->GetPrevious(); - while (previous != nullptr && previous->IsParallelMove()) { - previous = previous->GetPrevious(); - } - return previous == this; + return this == if_->GetPreviousDisregardingMoves(); } bool HInstruction::Equals(HInstruction* other) const { |