# HG changeset patch # User Lukas Stadler # Date 1337105605 -7200 # Node ID 873a1fb5b349cdf2cf19ef384289b087751fa2e7 # Parent c574c454079136b3fd5665a84f1dca67ca07c843 look at the probability of IfNodes during ComputeLinearScanOrder diff -r c574c4540791 -r 873a1fb5b349 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/ComputeLinearScanOrder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/ComputeLinearScanOrder.java Tue May 15 14:29:14 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/ComputeLinearScanOrder.java Tue May 15 20:13:25 2012 +0200 @@ -304,13 +304,21 @@ Block cur = workList.remove(workList.size() - 1); appendBlock(cur); - int i; - int numSux = cur.numberOfSux(); - // changed loop order to get "intuitive" order of if- and else-blocks - for (i = 0; i < numSux; i++) { - Block sux = cur.suxAt(i); - if (readyForProcessing(sux)) { - sortIntoWorkList(sux); + // make the most successor with the highest probability the immediate successor + Node endNode = cur.getEndNode(); + if (endNode instanceof IfNode && ((IfNode) endNode).probability() < 0.5) { + assert cur.numberOfSux() == 2; + if (readyForProcessing(cur.suxAt(1))) { + sortIntoWorkList(cur.suxAt(1)); + } + if (readyForProcessing(cur.suxAt(0))) { + sortIntoWorkList(cur.suxAt(0)); + } + } else { + for (Block sux : cur.getSuccessors()) { + if (readyForProcessing(sux)) { + sortIntoWorkList(sux); + } } } } while (workList.size() > 0);