@@ -178,10 +178,16 @@ void ReplaceEffectControlUses(Node* node, Node* effect, Node* control) {
178178}
179179
180180bool 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+ }
185191 left = Type::Intersect (left, Type::Signed32 (), type_zone);
186192 right = Type::Intersect (right, Type::Signed32 (), type_zone);
187193 if (left.IsNone () || right.IsNone ()) return false ;
@@ -1457,7 +1463,8 @@ class RepresentationSelector {
14571463 if (lower<T>()) {
14581464 if (truncation.IsUsedAsWord32 () ||
14591465 !CanOverflowSigned32 (node->op (), left_feedback_type,
1460- right_feedback_type, graph_zone ())) {
1466+ right_feedback_type, type_cache_,
1467+ graph_zone ())) {
14611468 ChangeToPureOp (node, Int32Op (node));
14621469
14631470 } else {
0 commit comments