Index: src/compiler/x87/instruction-selector-x87.cc |
diff --git a/src/compiler/x87/instruction-selector-x87.cc b/src/compiler/x87/instruction-selector-x87.cc |
index 93c52e0eb7bda228d5a8b4b1649fbfa185a34ae3..a737d1e9e860ecc044c78cb6a3bffc18cad16575 100644 |
--- a/src/compiler/x87/instruction-selector-x87.cc |
+++ b/src/compiler/x87/instruction-selector-x87.cc |
@@ -1433,22 +1433,22 @@ void VisitWordCompare(InstructionSelector* selector, Node* node, |
// Shared routine for word comparison with zero. |
void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
Node* value, FlagsContinuation* cont) { |
- // Try to combine the branch with a comparison. |
- 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: { |
- // Try to 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 VisitWordCompare(selector, value, cont); |
- } |
case IrOpcode::kInt32LessThan: |
cont->OverwriteAndNegateIfEqual(kSignedLessThan); |
return VisitWordCompare(selector, value, cont); |
@@ -1514,7 +1514,6 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
default: |
break; |
} |
- break; |
} |
// Continuation could not be combined with a compare, emit compare against 0. |