Index: src/compiler/common-operator-reducer.cc |
diff --git a/src/compiler/common-operator-reducer.cc b/src/compiler/common-operator-reducer.cc |
index e4af2ad1f9b352a7654bdb1ea93f6f9cc775ddf9..e3c2ecad6ea10fe810e7c9e3e382fe9e5e0927e9 100644 |
--- a/src/compiler/common-operator-reducer.cc |
+++ b/src/compiler/common-operator-reducer.cc |
@@ -67,6 +67,8 @@ Reduction CommonOperatorReducer::Reduce(Node* node) { |
return ReduceReturn(node); |
case IrOpcode::kSelect: |
return ReduceSelect(node); |
+ case IrOpcode::kGuard: |
+ return ReduceGuard(node); |
default: |
break; |
} |
@@ -358,6 +360,16 @@ Reduction CommonOperatorReducer::ReduceSelect(Node* node) { |
} |
+Reduction CommonOperatorReducer::ReduceGuard(Node* node) { |
+ DCHECK_EQ(IrOpcode::kGuard, node->opcode()); |
+ Node* const input = NodeProperties::GetValueInput(node, 0); |
+ Type* const input_type = NodeProperties::GetTypeOrAny(input); |
+ Type* const guard_type = OpParameter<Type*>(node); |
+ if (input_type->Is(guard_type)) return Replace(input); |
+ return NoChange(); |
+} |
+ |
+ |
Reduction CommonOperatorReducer::Change(Node* node, Operator const* op, |
Node* a) { |
node->ReplaceInput(0, a); |