@@ -1381,7 +1381,6 @@ class RepresentationSelector {
1381
1381
IsSomePositiveOrderedNumber (input1_type)
1382
1382
? CheckForMinusZeroMode::kDontCheckForMinusZero
1383
1383
: CheckForMinusZeroMode::kCheckForMinusZero ;
1384
-
1385
1384
NodeProperties::ChangeOp (node, simplified ()->CheckedInt32Mul (mz_mode));
1386
1385
}
1387
1386
@@ -1425,6 +1424,13 @@ class RepresentationSelector {
1425
1424
1426
1425
Type left_feedback_type = TypeOf (node->InputAt (0 ));
1427
1426
Type right_feedback_type = TypeOf (node->InputAt (1 ));
1427
+
1428
+ // Using Signed32 as restriction type amounts to promising there won't be
1429
+ // signed overflow. This is incompatible with relying on a Word32
1430
+ // truncation in order to skip the overflow check.
1431
+ Type const restriction =
1432
+ truncation.IsUsedAsWord32 () ? Type::Any () : Type::Signed32 ();
1433
+
1428
1434
// Handle the case when no int32 checks on inputs are necessary (but
1429
1435
// an overflow check is needed on the output). Note that we do not
1430
1436
// have to do any check if at most one side can be minus zero. For
@@ -1438,7 +1444,7 @@ class RepresentationSelector {
1438
1444
right_upper.Is (Type::Signed32OrMinusZero ()) &&
1439
1445
(left_upper.Is (Type::Signed32 ()) || right_upper.Is (Type::Signed32 ()))) {
1440
1446
VisitBinop<T>(node, UseInfo::TruncatingWord32 (),
1441
- MachineRepresentation::kWord32 , Type::Signed32 () );
1447
+ MachineRepresentation::kWord32 , restriction );
1442
1448
} else {
1443
1449
// If the output's truncation is identify-zeros, we can pass it
1444
1450
// along. Moreover, if the operation is addition and we know the
@@ -1458,8 +1464,9 @@ class RepresentationSelector {
1458
1464
UseInfo right_use = CheckedUseInfoAsWord32FromHint (hint, FeedbackSource (),
1459
1465
kIdentifyZeros );
1460
1466
VisitBinop<T>(node, left_use, right_use, MachineRepresentation::kWord32 ,
1461
- Type::Signed32 () );
1467
+ restriction );
1462
1468
}
1469
+
1463
1470
if (lower<T>()) {
1464
1471
if (truncation.IsUsedAsWord32 () ||
1465
1472
!CanOverflowSigned32 (node->op (), left_feedback_type,
0 commit comments