Index: src/compiler/simplified-lowering.cc |
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
index c2c7457f3e5fd82438aedfd36fa62e516169dfdd..850977380ec780f47a77f189c136a62d450a0fa0 100644 |
--- a/src/compiler/simplified-lowering.cc |
+++ b/src/compiler/simplified-lowering.cc |
@@ -948,11 +948,16 @@ class RepresentationSelector { |
} |
case IrOpcode::kNumberAdd: |
case IrOpcode::kNumberSubtract: { |
- // Add and subtract reduce to Int32Add/Sub if the inputs |
- // are safe integers and all uses are truncating. |
- if (BothInputsAre(node, type_cache_.kAdditiveSafeInteger) && |
- truncation.TruncatesToWord32()) { |
+ if (BothInputsAre(node, Type::Signed32()) && |
+ NodeProperties::GetType(node)->Is(Type::Signed32())) { |
+ // int32 + int32 = int32 |
// => signed Int32Add/Sub |
+ VisitInt32Binop(node); |
+ if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
+ } else if (BothInputsAre(node, type_cache_.kAdditiveSafeInteger) && |
+ truncation.TruncatesToWord32()) { |
+ // safe-int + safe-int = x (truncated to int32) |
+ // => signed Int32Add/Sub (truncated) |
VisitWord32TruncatingBinop(node); |
if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
} else { |