# HG changeset patch # User Roland Schatz # Date 1384189012 -3600 # Node ID d61e3ca7c89b28ae4ef1b5573ab014968bf367e4 # Parent c61d1f1bbee0cdb39727ec0d275ee57909d7205c Canonicalize coversions that don't change the type. diff -r c61d1f1bbee0 -r d61e3ca7c89b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Mon Nov 11 17:54:16 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Mon Nov 11 17:56:52 2013 +0100 @@ -233,12 +233,18 @@ @Override public Node canonical(CanonicalizerTool tool) { - if (value.isConstant()) { + if (from == to) { + return value; + } else if (value.isConstant()) { return ConstantNode.forPrimitive(evalConst(value.asConstant()), graph()); } else if (value instanceof ConvertNode) { ConvertNode other = (ConvertNode) value; if (other.isLossless() && other.to != Kind.Char) { - return graph().unique(new ConvertNode(other.from, this.to, other.value())); + if (other.from == this.to) { + return other.value(); + } else { + return graph().unique(new ConvertNode(other.from, this.to, other.value())); + } } } return this;