# HG changeset patch # User Thomas Wuerthinger # Date 1424732424 -3600 # Node ID 8a764553675d0a75632d53cda0c6c3f4fb4bcb76 # Parent f4c5516ac919ec93e088a1e06ebbab69b2398568 Simplify earliest block calculations in schedule phase. diff -r f4c5516ac919 -r 8a764553675d graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Mon Feb 23 23:57:56 2015 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Tue Feb 24 00:00:24 2015 +0100 @@ -676,10 +676,8 @@ } else { inputEarliest = earliestBlock(input); } - if (earliest == null) { + if (earliest == null || earliest.getDominatorDepth() < inputEarliest.getDominatorDepth()) { earliest = inputEarliest; - } else if (earliest != inputEarliest) { - earliest = findEarlierBlock(earliest, inputEarliest); } } } @@ -690,23 +688,6 @@ return earliest; } - private static Block findEarlierBlock(Block earliest, Block inputEarliest) { - // Find out whether earliest or inputEarliest is earlier. - Block a = earliest.getDominator(); - Block b = inputEarliest; - while (true) { - if (a == inputEarliest || b == null) { - // Nothing to change, the previous earliest block is still earliest. - return earliest; - } else if (b == earliest || a == null) { - // New earliest is the earliest. - return inputEarliest; - } - a = a.getDominator(); - b = b.getDominator(); - } - } - /** * Schedules a node out of loop based on its earliest schedule. Note that this movement is only * valid if it's done for every other node in the schedule, otherwise this movement is