Index: src/compiler/simplified-lowering.cc |
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
index 449c882e79c5c3ff9bf9fd1ea3cd55b8160b509f..3e7071ab51236e0f23a60ef187e2c149b18c7d3f 100644 |
--- a/src/compiler/simplified-lowering.cc |
+++ b/src/compiler/simplified-lowering.cc |
@@ -487,6 +487,12 @@ class RepresentationSelector { |
} |
return false; |
} |
+ // We need to guarantee that the feedback type is a subtype of the upper |
+ // bound. Naively that should hold, but weakening can actually produce |
+ // a bigger type if we are unlucky with ordering of phi typing. To be |
+ // really sure, just intersect the upper bound with the feedback type. |
+ new_type = Type::Intersect(GetUpperBound(node), new_type, graph_zone()); |
+ |
if (type != nullptr && new_type->Is(type)) return false; |
GetInfo(node)->set_feedback_type(new_type); |
if (FLAG_trace_representation) { |