changeset 21446:43462ed89797

MoveResolver: recognize self assignment even on Kind mismatch.
author Josef Eisl <josef.eisl@jku.at>
date Thu, 21 May 2015 11:54:22 +0200
parents 567fd5394b80
children f172a195a8a9
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java	Thu May 21 11:51:32 2015 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java	Thu May 21 11:54:22 2015 +0200
@@ -198,7 +198,7 @@
 
         Value location = to.location();
         if (mightBeBlocked(location)) {
-            if ((valueBlocked(location) > 1 || (valueBlocked(location) == 1 && !location.equals(fromReg)))) {
+            if ((valueBlocked(location) > 1 || (valueBlocked(location) == 1 && !isMoveToSelf(fromReg, location)))) {
                 return false;
             }
         }
@@ -206,6 +206,18 @@
         return true;
     }
 
+    protected boolean isMoveToSelf(Value from, Value to) {
+        assert to != null;
+        if (to.equals(from)) {
+            return true;
+        }
+        if (from != null && isRegister(from) && isRegister(to) && asRegister(from).equals(asRegister(to))) {
+            assert LIRKind.verifyMoveKinds(to.getLIRKind(), from.getLIRKind()) : String.format("Same register but Kind mismatch %s <- %s", to, from);
+            return true;
+        }
+        return false;
+    }
+
     protected boolean mightBeBlocked(Value location) {
         return isRegister(location);
     }