# HG changeset patch # User Lukas Stadler # Date 1396859716 -7200 # Node ID 4976f469670eb184066155738eb032c20542c9cf # Parent 610784692a5e7d9016b7faf6526c4257b9cf2d9f remove unnecessary proxies during loop peeling diff -r 610784692a5e -r 4976f469670e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Sun Apr 06 19:31:59 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Mon Apr 07 10:35:16 2014 +0200 @@ -31,6 +31,7 @@ import com.oracle.graal.nodes.VirtualState.VirtualClosure; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.java.*; +import com.oracle.graal.nodes.util.*; import com.oracle.graal.nodes.virtual.*; public abstract class LoopFragment { @@ -285,6 +286,7 @@ if (newEarlyExit == null) { continue; } + boolean newEarlyExitIsBegin = newEarlyExit instanceof BeginNode; MergeNode merge = graph.add(new MergeNode()); AbstractEndNode originalEnd = graph.add(new EndNode()); AbstractEndNode newEnd = graph.add(new EndNode()); @@ -340,7 +342,7 @@ throw GraalInternalError.shouldNotReachHere(); } phi.addInput(vpn); - phi.addInput(newVpn); + phi.addInput(newEarlyExitIsBegin ? newVpn.value() : newVpn); replaceWith = phi; } else { replaceWith = vpn.value(); @@ -357,6 +359,16 @@ } } } + if (newEarlyExitIsBegin) { + FrameState stateAtNewEarlyExit = newEarlyExit.stateAfter(); + if (stateAtNewEarlyExit != null) { + newEarlyExit.setStateAfter(null); + GraphUtil.killWithUnusedFloatingInputs(stateAtNewEarlyExit); + } + for (ProxyNode proxy : newEarlyExit.proxies().snapshot()) { + GraphUtil.killWithUnusedFloatingInputs(proxy); + } + } } } }