File tree 1 file changed +15
-1
lines changed
runtime/vm/compiler/backend
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1499,11 +1499,25 @@ void ConstantPropagator::VisitCaseInsensitiveCompare(
1499
1499
}
1500
1500
1501
1501
void ConstantPropagator::VisitUnbox (UnboxInstr* instr) {
1502
- const Object& value = instr->value ()->definition ()->constant_value ();
1502
+ Object& value = instr->value ()->definition ()->constant_value ();
1503
1503
if (IsUnknown (value)) {
1504
1504
return ;
1505
1505
}
1506
1506
1507
+ if (auto * unbox_int = instr->AsUnboxInteger ()) {
1508
+ if (!value.IsInteger ()) {
1509
+ SetValue (instr, non_constant_);
1510
+ return ;
1511
+ }
1512
+ if (unbox_int->is_truncating () &&
1513
+ ((unbox_int->representation () == kUnboxedInt32 ) ||
1514
+ (unbox_int->representation () == kUnboxedUint32 ))) {
1515
+ const int64_t result_val = Evaluator::TruncateTo (
1516
+ Integer::Cast (value).Value (), unbox_int->representation ());
1517
+ value = Integer::NewCanonical (result_val);
1518
+ }
1519
+ }
1520
+
1507
1521
SetValue (instr, value);
1508
1522
}
1509
1523
You can’t perform that action at this time.
0 commit comments