# HG changeset patch # User Tom Rodriguez # Date 1395161339 25200 # Node ID 9e05e9770c1e64cf64ac8d1a6cb183c86d4f908e # Parent a23ca654a8821534d1178e76d878f7444221ec28 eliminate useless masking diff -r a23ca654a882 -r 9e05e9770c1e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Thu Mar 13 15:41:24 2014 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Tue Mar 18 09:48:59 2014 -0700 @@ -66,6 +66,14 @@ if ((rawY & mask) == 0) { return ConstantNode.forIntegerStamp(stamp(), 0, graph()); } + if (x().stamp() instanceof IntegerStamp) { + IntegerStamp xStamp = (IntegerStamp) x().stamp(); + if (((xStamp.upMask() | xStamp.downMask()) & ~rawY) == 0) { + // No bits are set which are outside the mask, so the mask will have no effect. + return x(); + } + } + return BinaryNode.reassociate(this, ValueNode.isConstantPredicate()); } return this;