changeset 19570:8a764553675d

Simplify earliest block calculations in schedule phase.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 24 Feb 2015 00:00:24 +0100
parents f4c5516ac919
children f7c6b33489c9 f918e65eb2bb
files graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java
diffstat 1 files changed, 1 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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 <b>every</b> other node in the schedule, otherwise this movement is