OSDN Git Service

Bug fix for SCCP improperly handling phis with some constant sources.
authorjeffhao <jeffhao@google.com>
Mon, 25 Apr 2011 22:15:08 +0000 (15:15 -0700)
committerjeffhao <jeffhao@google.com>
Mon, 25 Apr 2011 22:54:26 +0000 (15:54 -0700)
Change-Id: Ib6e2ab17b50c90d7d83658c69dfba1d065a42155

dx/src/com/android/dx/ssa/SCCP.java

index f62d611..1ef0fca 100644 (file)
@@ -152,7 +152,7 @@ public class SCCP {
      * Simulates a PHI node and set the lattice for the result
      * to the appropriate value.
      * Meet values:
-     * TOP x anything = anything
+     * TOP x anything = TOP
      * VARYING x anything = VARYING
      * CONSTANT x CONSTANT = CONSTANT if equal constants, VARYING otherwise
      * @param insn PHI to simulate.
@@ -174,8 +174,7 @@ public class SCCP {
             int sourceReg = sources.get(i).getReg();
             int sourceRegValue = latticeValues[sourceReg];
 
-            if (!executableBlocks.get(predBlockIndex)
-                    || sourceRegValue == TOP) {
+            if (!executableBlocks.get(predBlockIndex)) {
                 continue;
             }
 
@@ -187,9 +186,8 @@ public class SCCP {
                     phiResultValue = VARYING;
                     break;
                 }
-
-            } else if (sourceRegValue == VARYING) {
-                phiResultValue = VARYING;
+            } else {
+                phiResultValue = sourceRegValue;
                 break;
             }
         }