Index: src/compiler/s390/instruction-selector-s390.cc |
diff --git a/src/compiler/s390/instruction-selector-s390.cc b/src/compiler/s390/instruction-selector-s390.cc |
index 84938dfd9f2a7fd8ddca383b69f61f2575848ef1..92705fc5b0aa08a9f3a7422258fa3d504a94d8c9 100644 |
--- a/src/compiler/s390/instruction-selector-s390.cc |
+++ b/src/compiler/s390/instruction-selector-s390.cc |
@@ -1607,21 +1607,22 @@ void VisitFloat64Compare(InstructionSelector* selector, Node* node, |
void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
Node* value, InstructionCode opcode, |
FlagsContinuation* cont) { |
- 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); |
@@ -1740,7 +1741,6 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
default: |
break; |
} |
- break; |
} |
// Branch could not be combined with a compare, emit compare against 0. |