Index: src/compiler/common-operator-reducer.cc |
diff --git a/src/compiler/common-operator-reducer.cc b/src/compiler/common-operator-reducer.cc |
index b07383d21c5ed7b554273d24f98d933ab8808d98..c66cce0538794f8019fba27966bc3181b088113d 100644 |
--- a/src/compiler/common-operator-reducer.cc |
+++ b/src/compiler/common-operator-reducer.cc |
@@ -51,17 +51,10 @@ Reduction CommonOperatorReducer::ReducePhi(Node* node) { |
Node* vtrue = NodeProperties::GetValueInput(node, 0); |
Node* vfalse = NodeProperties::GetValueInput(node, 1); |
Node* merge = NodeProperties::GetControlInput(node); |
- Node* if_true = NodeProperties::GetControlInput(merge, 0); |
- Node* if_false = NodeProperties::GetControlInput(merge, 1); |
- if (if_true->opcode() != IrOpcode::kIfTrue) { |
- std::swap(if_true, if_false); |
- std::swap(vtrue, vfalse); |
- } |
- if (if_true->opcode() == IrOpcode::kIfTrue && |
- if_false->opcode() == IrOpcode::kIfFalse && |
- if_true->InputAt(0) == if_false->InputAt(0)) { |
- Node* branch = if_true->InputAt(0); |
- Node* cond = branch->InputAt(0); |
+ DiamondMatcher matcher(merge); |
+ if (matcher.Matched()) { |
+ if (matcher.IfTrue() == merge->InputAt(1)) std::swap(vtrue, vfalse); |
+ Node* cond = matcher.Branch()->InputAt(0); |
if (cond->opcode() == IrOpcode::kFloat64LessThan) { |
if (cond->InputAt(0) == vtrue && cond->InputAt(1) == vfalse && |
machine()->HasFloat64Min()) { |