@@ -178,10 +178,16 @@ void ReplaceEffectControlUses(Node* node, Node* effect, Node* control) {
178
178
}
179
179
180
180
bool CanOverflowSigned32 (const Operator* op, Type left, Type right,
181
- Zone* type_zone) {
182
- // We assume the inputs are checked Signed32 (or known statically
183
- // to be Signed32). Technically, the inputs could also be minus zero, but
184
- // that cannot cause overflow.
181
+ TypeCache const * type_cache, Zone* type_zone) {
182
+ // We assume the inputs are checked Signed32 (or known statically to be
183
+ // Signed32). Technically, the inputs could also be minus zero, which we treat
184
+ // as 0 for the purpose of this function.
185
+ if (left.Maybe (Type::MinusZero ())) {
186
+ left = Type::Union (left, type_cache->kSingletonZero , type_zone);
187
+ }
188
+ if (right.Maybe (Type::MinusZero ())) {
189
+ right = Type::Union (right, type_cache->kSingletonZero , type_zone);
190
+ }
185
191
left = Type::Intersect (left, Type::Signed32 (), type_zone);
186
192
right = Type::Intersect (right, Type::Signed32 (), type_zone);
187
193
if (left.IsNone () || right.IsNone ()) return false ;
@@ -1457,7 +1463,8 @@ class RepresentationSelector {
1457
1463
if (lower<T>()) {
1458
1464
if (truncation.IsUsedAsWord32 () ||
1459
1465
!CanOverflowSigned32 (node->op (), left_feedback_type,
1460
- right_feedback_type, graph_zone ())) {
1466
+ right_feedback_type, type_cache_,
1467
+ graph_zone ())) {
1461
1468
ChangeToPureOp (node, Int32Op (node));
1462
1469
1463
1470
} else {
0 commit comments