Index: src/compiler/load-elimination.cc |
diff --git a/src/compiler/load-elimination.cc b/src/compiler/load-elimination.cc |
index a451cfce732d18d7a25aaec7234474cbdb57157d..0f9809ea3af895f5001c75bb6b6b13c6eb7310f4 100644 |
--- a/src/compiler/load-elimination.cc |
+++ b/src/compiler/load-elimination.cc |
@@ -25,6 +25,19 @@ Reduction LoadElimination::Reduce(Node* node) { |
return NoChange(); |
} |
+namespace { |
+ |
+// If {node} is a CheckTaggedPointer, follow its input until {node} is no |
+// longer a CheckTaggedPointer. |
+Node* NormalizeCheckTaggedPointer(Node* node) { |
+ while (node->opcode() == IrOpcode::kCheckTaggedPointer) { |
+ node = NodeProperties::GetValueInput(node, 0); |
+ } |
+ return node; |
+} |
+ |
+} // namespace |
+ |
Reduction LoadElimination::ReduceLoadField(Node* node) { |
DCHECK_EQ(IrOpcode::kLoadField, node->opcode()); |
FieldAccess const access = FieldAccessOf(node->op()); |
@@ -44,7 +57,9 @@ Reduction LoadElimination::ReduceLoadField(Node* node) { |
} |
case IrOpcode::kStoreField: { |
if (access == FieldAccessOf(effect->op())) { |
- if (object == NodeProperties::GetValueInput(effect, 0)) { |
+ Node* value_input = NormalizeCheckTaggedPointer( |
+ NodeProperties::GetValueInput(effect, 0)); |
+ if (object == value_input) { |
Node* const value = NodeProperties::GetValueInput(effect, 1); |
Type* stored_value_type = NodeProperties::GetType(value); |
Type* load_type = NodeProperties::GetType(node); |
@@ -74,7 +89,8 @@ Reduction LoadElimination::ReduceLoadField(Node* node) { |
// These can never interfere with field loads. |
break; |
} |
- case IrOpcode::kFinishRegion: { |
+ case IrOpcode::kFinishRegion: |
+ case IrOpcode::kCheckTaggedPointer: { |
// "Look through" FinishRegion nodes to make LoadElimination capable |
// of looking into atomic regions. |
if (object == effect) object = NodeProperties::GetValueInput(effect, 0); |