Index: src/compiler/machine-operator-reducer.cc |
diff --git a/src/compiler/machine-operator-reducer.cc b/src/compiler/machine-operator-reducer.cc |
index a40da1360cfbfb3dc23f5ce05e75b2b1dbd4e4a4..98873c3f1e3bfe02b61f9713160fb7b16b3db5a6 100644 |
--- a/src/compiler/machine-operator-reducer.cc |
+++ b/src/compiler/machine-operator-reducer.cc |
@@ -600,6 +600,7 @@ Reduction MachineOperatorReducer::ReduceUint32Div(Node* node) { |
return Replace(Word32Equal(Word32Equal(m.left().node(), zero), zero)); |
} |
if (m.right().IsPowerOf2()) { // x / 2^n => x >> n |
+ node->TrimInputCount(2); |
node->set_op(machine()->Word32Shr()); |
node->ReplaceInput(1, Uint32Constant(WhichPowerOf2(m.right().Value()))); |
return Changed(node); |
@@ -665,6 +666,7 @@ Reduction MachineOperatorReducer::ReduceUint32Mod(Node* node) { |
base::bits::UnsignedMod32(m.left().Value(), m.right().Value())); |
} |
if (m.right().IsPowerOf2()) { // x % 2^n => x & 2^n-1 |
+ node->TrimInputCount(2); |
node->set_op(machine()->Word32And()); |
node->ReplaceInput(1, Uint32Constant(m.right().Value() - 1)); |
return Changed(node); |