Mercurial > hg > graal-compiler
changeset 15151:1dc1af3bf402
use node.replaceAtMatchingUsages in LoopFragment.mergeEarlyExits
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 14 Apr 2014 19:27:12 +0200 |
parents | 101a31da0dd0 |
children | 5f75a06505a6 |
files | graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java |
diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Tue Apr 15 18:33:33 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Mon Apr 14 19:27:12 2014 +0200 @@ -355,6 +355,7 @@ } }); } + FrameState finalExitState = exitState; for (Node anchored : loopEarlyExit.anchored().snapshot()) { anchored.replaceFirstInput(loopEarlyExit, merge); @@ -384,17 +385,18 @@ } else { replaceWith = vpn.value(); } - for (Node usage : vpn.usages().snapshot()) { - if (!merge.isPhiAtMerge(usage)) { - if (usage instanceof VirtualState) { - VirtualState stateUsage = (VirtualState) usage; - if (exitState.isPartOfThisState(stateUsage)) { - continue; - } + vpn.replaceAtMatchingUsages(replaceWith, usage -> { + if (merge.isPhiAtMerge(usage)) { + return false; + } + if (usage instanceof VirtualState) { + VirtualState stateUsage = (VirtualState) usage; + if (finalExitState.isPartOfThisState(stateUsage)) { + return false; } - usage.replaceFirstInput(vpn, replaceWith); } - } + return true; + }); } } }