# HG changeset patch # User Thomas Wuerthinger # Date 1450023104 -3600 # Node ID db2df49e2245b2cd2e6c544223f185af2478e059 # Parent 2ad910b35d66ba9c3567f10601b81e37aa5077aa Canonicalize value proxies of loop phis. diff -r 2ad910b35d66 -r db2df49e2245 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Sun Dec 13 16:17:29 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Sun Dec 13 17:11:44 2015 +0100 @@ -59,11 +59,11 @@ return super.verify(); } - public static ValueProxyNode forValue(ValueNode value, AbstractBeginNode exit, StructuredGraph graph) { + public static ValueProxyNode forValue(ValueNode value, LoopExitNode exit, StructuredGraph graph) { return graph.unique(new ValueProxyNode(value, exit)); } - public static GuardProxyNode forGuard(GuardingNode value, AbstractBeginNode exit, StructuredGraph graph) { + public static GuardProxyNode forGuard(GuardingNode value, LoopExitNode exit, StructuredGraph graph) { return graph.unique(new GuardProxyNode(value, exit)); } } diff -r 2ad910b35d66 -r db2df49e2245 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Sun Dec 13 16:17:29 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Sun Dec 13 17:11:44 2015 +0100 @@ -38,9 +38,12 @@ public static final NodeClass TYPE = NodeClass.create(ValueProxyNode.class); @Input ValueNode value; + private final boolean loopPhiProxy; + public ValueProxyNode(ValueNode value, AbstractBeginNode proxyPoint) { super(TYPE, value.stamp(), proxyPoint); this.value = value; + loopPhiProxy = (proxyPoint instanceof LoopExitNode && value instanceof PhiNode && ((PhiNode) value).merge() == ((LoopExitNode) proxyPoint).loopBegin()); } @Override @@ -58,6 +61,13 @@ if (value.isConstant()) { return value; } + if (loopPhiProxy && proxyPoint instanceof LoopExitNode) { + if (!(value instanceof PhiNode)) { + return value; + } else if (((PhiNode) value).merge() != ((LoopExitNode) proxyPoint).loopBegin()) { + return value; + } + } return this; } diff -r 2ad910b35d66 -r db2df49e2245 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Sun Dec 13 16:17:29 2015 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Sun Dec 13 17:11:44 2015 +0100 @@ -184,7 +184,7 @@ Node newGuard = guard; if (survivingSuccessor instanceof LoopExitNode) { - newGuard = ProxyNode.forGuard(guard, survivingSuccessor, graph); + newGuard = ProxyNode.forGuard(guard, (LoopExitNode) survivingSuccessor, graph); } survivingSuccessor.replaceAtUsages(InputType.Guard, newGuard);