diff graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java @ 2768:43ffa0e47a46

Towards removing stateAfter on BlockEnd.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Mon, 23 May 2011 19:21:53 +0200
parents 99912abb3ff7
children dd6419f4bfe2
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java	Mon May 23 16:23:28 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java	Mon May 23 19:21:53 2011 +0200
@@ -331,7 +331,7 @@
             Value x = valueAt(i);
             if (x != null) {
                 Value y = other.valueAt(i);
-                if (x != y) {
+                if (x != y || ((x instanceof Phi) && ((Phi) x).block() == block)) {
                     if (typeMismatch(x, y)) {
                         if (x instanceof Phi) {
                             Phi phi = (Phi) x;
@@ -360,18 +360,20 @@
                         for (int j = 0; j < size; ++j) {
                             phi = phi.addInput(x);
                         }
-                        phi = phi.addInput(y);
+                        phi = phi.addInput((x == y) ? phi : y);
                     } else {
-                        phi = phi.addInput(y);
+                        phi = phi.addInput((x == y) ? phi : y);
                     }
-                    if (originalPhi != phi) {
+                    /*if (originalPhi != phi) {
                         for (int j = 0; j < other.localsSize() + other.stackSize(); ++j) {
                             if (other.valueAt(j) == originalPhi) {
                                 other.setValueAt(j, phi);
                             }
                         }
-                    }
-                }
+                    }*/
+
+                    //assert phi.valueCount() == block.predecessors().size() + (blockAppended ? 0 : 1) : "valueCount=" + phi.valueCount() + " predSize= " + block.predecessors().size();
+               }
             }
         }
     }