Index: src/compiler/x64/instruction-selector-x64.cc |
diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc |
index c5e31278d9c2263bded185314a5529e58aec7ff0..a677733751252a2ddad807e1ec6273aa6618c00a 100644 |
--- a/src/compiler/x64/instruction-selector-x64.cc |
+++ b/src/compiler/x64/instruction-selector-x64.cc |
@@ -1869,21 +1869,22 @@ void VisitFloat64Compare(InstructionSelector* selector, Node* node, |
// Shared routine for word comparison against zero. |
void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
Node* value, 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 VisitWordCompare(selector, value, kX64Cmp32, cont); |
- } |
case IrOpcode::kInt32LessThan: |
cont->OverwriteAndNegateIfEqual(kSignedLessThan); |
return VisitWordCompare(selector, value, kX64Cmp32, cont); |
@@ -1992,7 +1993,6 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user, |
default: |
break; |
} |
- break; |
} |
// Branch could not be combined with a compare, emit compare against 0. |