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..aaf32bc07f208e56c0a44f8974932f86b3d08d9b 100644 |
--- a/src/compiler/machine-operator-reducer.cc |
+++ b/src/compiler/machine-operator-reducer.cc |
@@ -600,8 +600,9 @@ Reduction MachineOperatorReducer::ReduceUint32Div(Node* node) { |
return Replace(Word32Equal(Word32Equal(m.left().node(), zero), zero)); |
} |
if (m.right().IsPowerOf2()) { // x / 2^n => x >> n |
- node->set_op(machine()->Word32Shr()); |
node->ReplaceInput(1, Uint32Constant(WhichPowerOf2(m.right().Value()))); |
Benedikt Meurer
2014/10/29 18:26:45
Let's keep the set_op() before ReplaceInput.
Jarin
2014/10/29 21:12:24
Done.
I am wondering what's the reason for this.
|
+ node->TrimInputCount(2); |
+ node->set_op(machine()->Word32Shr()); |
return Changed(node); |
} |
return NoChange(); |
@@ -665,8 +666,9 @@ 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->set_op(machine()->Word32And()); |
node->ReplaceInput(1, Uint32Constant(m.right().Value() - 1)); |
+ node->TrimInputCount(2); |
+ node->set_op(machine()->Word32And()); |
Benedikt Meurer
2014/10/29 18:26:45
Same here.
Jarin
2014/10/29 21:12:24
Done.
|
return Changed(node); |
} |
return NoChange(); |