Chromium Code Reviews| 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 c841acebc0667ea95086a3c29a825650f70d1643..839af8e45542dd64bcf7ab157decf681da805527 100644 |
| --- a/src/compiler/x64/instruction-selector-x64.cc |
| +++ b/src/compiler/x64/instruction-selector-x64.cc |
| @@ -1313,9 +1313,27 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
| case IrOpcode::kUint32LessThanOrEqual: |
| cont.OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); |
| return VisitWordCompare(this, value, kX64Cmp32, &cont); |
| - case IrOpcode::kWord64Equal: |
| + case IrOpcode::kWord64Equal: { |
| cont.OverwriteAndNegateIfEqual(kEqual); |
| + Int64BinopMatcher m(value); |
| + if (m.right().Is(0)) { |
| + // Try to combine the branch with a comparison. |
| + Node* const user = m.node(); |
| + Node* const value = m.left().node(); |
|
Jarin
2015/06/24 07:35:59
Could you avoid shadowing the 'user' and 'value' v
Benedikt Meurer
2015/06/24 07:38:18
Done.
|
| + if (CanCover(user, value)) { |
| + switch (value->opcode()) { |
| + case IrOpcode::kInt64Sub: |
| + return VisitWord64Compare(this, value, &cont); |
| + case IrOpcode::kWord64And: |
| + return VisitWordCompare(this, value, kX64Test, &cont); |
| + default: |
| + break; |
| + } |
| + } |
| + return VisitCompareZero(this, value, kX64Cmp, &cont); |
| + } |
| return VisitWord64Compare(this, value, &cont); |
| + } |
| case IrOpcode::kInt64LessThan: |
| cont.OverwriteAndNegateIfEqual(kSignedLessThan); |
| return VisitWord64Compare(this, value, &cont); |
| @@ -1478,25 +1496,12 @@ void InstructionSelector::VisitUint32LessThanOrEqual(Node* node) { |
| void InstructionSelector::VisitWord64Equal(Node* const node) { |
| - Node* user = node; |
| FlagsContinuation cont(kEqual, node); |
| - Int64BinopMatcher m(user); |
| + Int64BinopMatcher m(node); |
| if (m.right().Is(0)) { |
| - Node* value = m.left().node(); |
| - |
| - // Try to combine with comparisons against 0 by simply inverting the branch. |
| - while (CanCover(user, value) && value->opcode() == IrOpcode::kWord64Equal) { |
| - Int64BinopMatcher m(value); |
| - if (m.right().Is(0)) { |
| - user = value; |
| - value = m.left().node(); |
| - cont.Negate(); |
| - } else { |
| - break; |
| - } |
| - } |
| - |
| - // Try to combine the branch with a comparison. |
| + // Try to combine the equality check with a comparison. |
| + Node* const user = m.node(); |
| + Node* const value = m.left().node(); |
| if (CanCover(user, value)) { |
| switch (value->opcode()) { |
| case IrOpcode::kInt64Sub: |
| @@ -1507,7 +1512,6 @@ void InstructionSelector::VisitWord64Equal(Node* const node) { |
| break; |
| } |
| } |
| - return VisitCompareZero(this, value, kX64Cmp, &cont); |
| } |
| VisitWord64Compare(this, node, &cont); |
| } |