Index: runtime/vm/flow_graph_optimizer.cc |
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc |
index 9cedab65a54107586eec149848ec03778a56e011..f8d72e90888538e26cf4fa654217641693de0b2b 100644 |
--- a/runtime/vm/flow_graph_optimizer.cc |
+++ b/runtime/vm/flow_graph_optimizer.cc |
@@ -750,6 +750,27 @@ static void UnboxPhi(PhiInstr* phi) { |
break; |
} |
+ if ((unboxed == kTagged) && |
+ phi->Type()->IsInt() && |
+ RangeUtils::Fits(phi->range(), RangeBoundary::kRangeBoundaryInt32)) { |
+ bool should_unbox = false; |
+ for (intptr_t i = 0; i < phi->InputCount(); i++) { |
+ Definition* input = phi->InputAt(i)->definition(); |
+ if (input->IsBox() && |
+ RangeUtils::Fits(input->range(), |
+ RangeBoundary::kRangeBoundaryInt32)) { |
+ should_unbox = true; |
+ } else if (!input->IsConstant()) { |
+ should_unbox = false; |
+ break; |
+ } |
+ } |
+ |
+ if (should_unbox) { |
+ unboxed = kUnboxedInt32; |
+ } |
+ } |
+ |
phi->set_representation(unboxed); |
} |