changeset 11333:a07d9113d1f6

Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 16 Aug 2013 20:52:29 +0200
parents e4a1593cc6e4
children 7f713aad89de
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Fri Aug 16 19:07:10 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Fri Aug 16 20:52:29 2013 +0200
@@ -86,12 +86,20 @@
                 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.
-                    n.replaceFirstInput(survivingSuccessor, guard);
+                    if (survivingSuccessor instanceof LoopExitNode) {
+                        if (proxyGuard == null) {
+                            proxyGuard = ProxyNode.forValue(guard, survivingSuccessor, graph);
+                        }
+                        n.replaceFirstInput(survivingSuccessor, proxyGuard);
+                    } else {
+                        n.replaceFirstInput(survivingSuccessor, guard);
+                    }
                 }
             }
             Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s.", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin);