# HG changeset patch # User Thomas Wuerthinger # Date 1429532226 -7200 # Node ID 2e0a55d381ea134aa48038ddb16021c30ed2d657 # Parent bf14fc8f5489f717aa0ee7c4f6487ad558ded082 Fix an issue in the ConvertDeoptimizeToGuardPhase that was moving dependent guarded nodes to the wrong new node. diff -r bf14fc8f5489 -r 2e0a55d381ea 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 Mon Apr 20 12:04:41 2015 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Mon Apr 20 14:17:06 2015 +0200 @@ -30,6 +30,7 @@ import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.spi.*; +import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.util.*; @@ -159,22 +160,13 @@ survivingSuccessor = ifNode.trueSuccessor(); } graph.removeSplitPropagate(ifNode, survivingSuccessor); - ProxyNode proxyGuard = null; - for (Node n : survivingSuccessor.usages().snapshot()) { - if (n instanceof GuardNode || n instanceof ProxyNode) { - // Keep wired to the begin node. - } else { - // Rewire to the fixed guard. - if (survivingSuccessor instanceof LoopExitNode) { - if (proxyGuard == null) { - proxyGuard = ProxyNode.forGuard(guard, survivingSuccessor, graph); - } - n.replaceFirstInput(survivingSuccessor, proxyGuard); - } else { - n.replaceFirstInput(survivingSuccessor, guard); - } - } + + Node newGuard = guard; + if (survivingSuccessor instanceof LoopExitNode) { + newGuard = ProxyNode.forGuard(guard, survivingSuccessor, graph); } + survivingSuccessor.replaceAtUsages(InputType.Guard, newGuard); + Debug.log("Converting deopt on %-5s branch of %s to guard for remaining branch %s.", deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin); FixedNode next = pred.next(); pred.setNext(guard);