OSDN Git Service

Dx reg allocator fix for accidental long/double clobbering.
authorjeffhao <jeffhao@google.com>
Fri, 26 Aug 2011 22:01:11 +0000 (15:01 -0700)
committerjeffhao <jeffhao@google.com>
Fri, 26 Aug 2011 22:43:03 +0000 (15:43 -0700)
Addresses this bug: http://b/issue?id=5215643.

Change-Id: I82613c38b0a6247d071aa6c5cc90bf8b60d5d84b

dx/src/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java

index ed82a31..9ef95a7 100644 (file)
@@ -1039,7 +1039,9 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator {
 
         for (int i = 0; i < sourcesSize; i++) {
             RegisterSpec source = sources.get(i);
-            int sourceReg = source.getReg();
+            SsaInsn def = ssaMeth.getDefinitionForRegister(source.getReg());
+            RegisterSpec sourceDef = def.getResult();
+            int sourceReg = sourceDef.getReg();
 
             /*
              * If a source of the phi has an existing mapping, get it.
@@ -1048,7 +1050,7 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator {
             if (ssaRegsMapped.get(sourceReg)) {
                 mapSet.add(mapper.oldToNew(sourceReg));
             } else {
-                ssaRegs.add(source);
+                ssaRegs.add(sourceDef);
             }
         }