Index: src/compiler/arm64/instruction-selector-arm64.cc |
diff --git a/src/compiler/arm64/instruction-selector-arm64.cc b/src/compiler/arm64/instruction-selector-arm64.cc |
index be56d5cc81c37bffafeb04150b75e3636e41cae5..0eef53c6d510ccb5b3224288fec5b8cdcead6df6 100644 |
--- a/src/compiler/arm64/instruction-selector-arm64.cc |
+++ b/src/compiler/arm64/instruction-selector-arm64.cc |
@@ -2353,21 +2353,22 @@ void VisitFloat64Compare(InstructionSelector* selector, Node* node, |
void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
Node* value, FlagsContinuation* cont) { |
Arm64OperandGenerator g(selector); |
- while (selector->CanCover(user, value)) { |
+ // Try to combine with comparisons against 0 by simply inverting the branch. |
+ while (value->opcode() == IrOpcode::kWord32Equal && |
+ selector->CanCover(user, value)) { |
+ Int32BinopMatcher m(value); |
+ if (!m.right().Is(0)) break; |
+ |
+ user = value; |
+ value = m.left().node(); |
+ cont->Negate(); |
+ } |
+ |
+ if (selector->CanCover(user, value)) { |
switch (value->opcode()) { |
- case IrOpcode::kWord32Equal: { |
- // Combine with comparisons against 0 by simply inverting the |
- // continuation. |
- Int32BinopMatcher m(value); |
- if (m.right().Is(0)) { |
- user = value; |
- value = m.left().node(); |
- cont->Negate(); |
- continue; |
- } |
+ case IrOpcode::kWord32Equal: |
cont->OverwriteAndNegateIfEqual(kEqual); |
return VisitWord32Compare(selector, value, cont); |
- } |
case IrOpcode::kInt32LessThan: |
cont->OverwriteAndNegateIfEqual(kSignedLessThan); |
return VisitWord32Compare(selector, value, cont); |
@@ -2505,7 +2506,6 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
default: |
break; |
} |
- break; |
} |
// Branch could not be combined with a compare, compare against 0 and branch. |