changeset 21025:2e0a55d381ea

Fix an issue in the ConvertDeoptimizeToGuardPhase that was moving dependent guarded nodes to the wrong new node.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 20 Apr 2015 14:17:06 +0200
parents bf14fc8f5489
children 931b0acc8d2e
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java
diffstat 1 files changed, 7 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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);