# HG changeset patch # User Josef Eisl # Date 1401798763 -7200 # Node ID f5ae86b125fd38e9edb9d868d746511e0332a32e # Parent 83433cf49019ea9de428f4ae88883af58bfa8e25 LSRA optimization: skip walking to blocks with more than one predecessor. diff -r 83433cf49019 -r f5ae86b125fd graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java Tue Jun 03 11:01:58 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/OptimizingLinearScanWalker.java Tue Jun 03 14:32:43 2014 +0200 @@ -74,31 +74,33 @@ void walk() { try (Scope s = Debug.scope("OptimizingLinearScanWalker")) { for (AbstractBlock block : allocator.sortedBlocks) { - int nextBlock = allocator.getFirstLirInstructionId(block); - try (Scope s1 = Debug.scope("LSRAOptimization")) { - Debug.log("next block: %s (%d)", block, nextBlock); - } - try (Indent indent0 = Debug.indent()) { - walkTo(nextBlock); - + if (block.getPredecessorCount() == 1) { + int nextBlock = allocator.getFirstLirInstructionId(block); try (Scope s1 = Debug.scope("LSRAOptimization")) { - boolean changed = true; - // we need to do this because the active lists might change - loop: while (changed) { - changed = false; - try (Indent indent1 = Debug.logAndIndent("Active intervals: (block %s [%d])", block, nextBlock)) { - for (Interval active = activeLists.get(RegisterBinding.Any); active != Interval.EndMarker; active = active.next) { - Debug.log("active (any): %s", active); - if (optimize(nextBlock, block, active, RegisterBinding.Any)) { - changed = true; - break loop; + Debug.log("next block: %s (%d)", block, nextBlock); + } + try (Indent indent0 = Debug.indent()) { + walkTo(nextBlock); + + try (Scope s1 = Debug.scope("LSRAOptimization")) { + boolean changed = true; + // we need to do this because the active lists might change + loop: while (changed) { + changed = false; + try (Indent indent1 = Debug.logAndIndent("Active intervals: (block %s [%d])", block, nextBlock)) { + for (Interval active = activeLists.get(RegisterBinding.Any); active != Interval.EndMarker; active = active.next) { + Debug.log("active (any): %s", active); + if (optimize(nextBlock, block, active, RegisterBinding.Any)) { + changed = true; + break loop; + } } - } - for (Interval active = activeLists.get(RegisterBinding.Stack); active != Interval.EndMarker; active = active.next) { - Debug.log("active (stack): %s", active); - if (optimize(nextBlock, block, active, RegisterBinding.Stack)) { - changed = true; - break loop; + for (Interval active = activeLists.get(RegisterBinding.Stack); active != Interval.EndMarker; active = active.next) { + Debug.log("active (stack): %s", active); + if (optimize(nextBlock, block, active, RegisterBinding.Stack)) { + changed = true; + break loop; + } } } } @@ -115,10 +117,8 @@ assert currentBlock != null : "block must not be null"; assert currentInterval != null : "interval must not be null"; - if (currentBlock.getPredecessorCount() != 1) { - // more than one predecessors -> optimization not possible - return false; - } + assert currentBlock.getPredecessorCount() == 1 : "more than one predecessors -> optimization not possible"; + if (!currentInterval.isSplitChild()) { // interval is not a split child -> no need for optimization return false;