Mercurial > hg > graal-jvmci-8
changeset 3233:e3d3fd5b638a
Canonicalize Negate(Negate(x)) for int/long remove incorrect canonicalization of FloatSub(0.0, x) to Negate(x)
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Wed, 27 Jul 2011 11:53:37 +0200 |
parents | dcc79d5d0d82 |
children | 28e260179e6f 28071fae8577 |
files | ProblemsIdeas.txt graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatSub.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Negate.java |
diffstat | 3 files changed, 8 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/ProblemsIdeas.txt Wed Jul 27 10:33:03 2011 +0200 +++ b/ProblemsIdeas.txt Wed Jul 27 11:53:37 2011 +0200 @@ -79,3 +79,7 @@ * Rematerialize only the nodes that were affected by GVN This will probably require something that tracks changes to the Graph, the cost of such a tracking should be evaluated + +* Hints on register pressure + + Sometimes we can make better decisions if we know the register pressure, it would be nice to have a way to know about it. Maybe we have register allocation on SSA we can somehow interact with it and try to lower the pressure in some areas on request?
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatSub.java Wed Jul 27 10:33:03 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatSub.java Wed Jul 27 11:53:37 2011 +0200 @@ -92,20 +92,6 @@ } return new FloatAdd(kind, x, Constant.forDouble(-c, graph), sub.isStrictFP(), graph); } - } else if (x.isConstant()) { - // TODO (gd) check that Negate impl for floating point is really faster/better than 0.0 - x - if (kind == CiKind.Float) { - float c = x.asConstant().asFloat(); - if (c == 0.0f) { - return new Negate(y, graph); - } - } else { - assert kind == CiKind.Double; - double c = x.asConstant().asDouble(); - if (c == 0.0) { - return new Negate(y, graph); - } - } } return sub; }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Negate.java Wed Jul 27 10:33:03 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Negate.java Wed Jul 27 11:53:37 2011 +0200 @@ -35,9 +35,8 @@ public final class Negate extends FloatingNode { private static final NegateCanonicalizerOp CANONICALIZER = new NegateCanonicalizerOp(); - private static final int INPUT_COUNT = 2; + private static final int INPUT_COUNT = 1; private static final int INPUT_X = 0; - private static final int INPUT_Y = 1; private static final int SUCCESSOR_COUNT = 0; @@ -129,6 +128,9 @@ case Double: return Constant.forDouble(-x.asConstant().asDouble(), graph); } } + if (x instanceof Negate && x.kind == CiKind.Int || x.kind == CiKind.Long) { + return ((Negate) x).x(); + } return negate; } }