changeset 3003:a7a7e87ad230

Moved some code in the scheduler to the right place.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Thu, 16 Jun 2011 16:19:36 +0200
parents bf14154d5b14
children 7b1cdb0e21d9
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Thu Jun 16 16:09:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Thu Jun 16 16:19:36 2011 +0200
@@ -122,11 +122,6 @@
         for (Block block : blocks) {
             Node n = block.firstNode();
             if (n instanceof Merge) {
-                for (Node usage : n.usages()) {
-                    if (usage instanceof Phi || usage instanceof LoopCounter) {
-                        nodeToBlock.set(usage, block);
-                    }
-                }
                 Merge m = (Merge) n;
                 for (int i = 0; i < m.endCount(); ++i) {
                     EndNode end = m.endAt(i);
@@ -236,6 +231,16 @@
             return prevBlock;
         }
 
+        if (n instanceof Phi) {
+            Block block = nodeToBlock.get(((Phi) n).merge());
+            nodeToBlock.set(n, block);
+        }
+
+        if (n instanceof LoopCounter) {
+            Block block = nodeToBlock.get(((LoopCounter) n).loopBegin());
+            nodeToBlock.set(n, block);
+        }
+
         Block block = null;
         for (Node succ : n.successors()) {
             block = getCommonDominator(block, assignLatestPossibleBlockToNode(succ));