changeset 7250:01e3daf8569b

perform initial iteration in WordTypeRewriterPhase in the right order (fixes problems with phis)
author Lukas Stadler <lukas.stadler@jku.at>
date Mon, 17 Dec 2012 17:36:46 +0100
parents 3af2fcc319f1
children c305a0315bea
files graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java
diffstat 1 files changed, 2 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java	Mon Dec 17 17:35:04 2012 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java	Mon Dec 17 17:36:46 2012 +0100
@@ -33,6 +33,7 @@
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
+import com.oracle.graal.phases.util.*;
 import com.oracle.graal.snippets.Word.Opcode;
 import com.oracle.graal.snippets.Word.Operation;
 
@@ -53,7 +54,7 @@
 
     @Override
     protected void run(StructuredGraph graph) {
-        for (Node n : graph.getNodes()) {
+        for (Node n : GraphOrder.forwardGraph(graph)) {
             if (n instanceof ValueNode) {
                 ValueNode valueNode = (ValueNode) n;
                 if (isWord(valueNode)) {
@@ -313,16 +314,5 @@
     private void changeToWord(ValueNode valueNode) {
         assert !(valueNode instanceof ConstantNode) : "boxed Word constants should not appear in a snippet graph: " + valueNode + ", stamp: " + valueNode.stamp();
         valueNode.setStamp(StampFactory.forKind(wordKind));
-
-        // Propagate word kind.
-        for (Node n : valueNode.usages()) {
-            if (n instanceof PhiNode) {
-                changeToWord((ValueNode) n);
-                PhiNode phi = (PhiNode) n;
-                assert phi.type() == PhiType.Value;
-            } else if (n instanceof ReturnNode) {
-                changeToWord((ValueNode) n);
-            }
-        }
     }
 }