Mercurial > hg > graal-compiler
changeset 14593:9e05e9770c1e
eliminate useless masking
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 18 Mar 2014 09:48:59 -0700 |
parents | a23ca654a882 |
children | 3eda945af90a |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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;