simplify-rtx.c (simplify_replace_rtx): Allow replacement of matching registers.
authorRoger Sayle <roger@eyesopen.com>
Mon, 10 Jun 2002 22:29:14 +0000 (22:29 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Mon, 10 Jun 2002 22:29:14 +0000 (22:29 +0000)
* simplify-rtx.c (simplify_replace_rtx): Allow replacement
of matching registers.

From-SVN: r54476

gcc/ChangeLog
gcc/simplify-rtx.c

index 5b4b671ef097f04ee97f192824fc9a6b7c9ccc83..8d45988d53747390a2faad97ebefb610256921a5 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-10  Roger Sayle  <roger@eyesopen.com>
+
+       * simplify-rtx.c (simplify_replace_rtx): Allow replacement
+       of matching registers.
+
 2002-06-10  Roger Sayle  <roger@eyesopen.com>
 
        * toplev.c (rest_of_compilation): Disable early if-conversion pass.
index 5db501eccfcad155f076e45bb7582fe5771448ac..5a4509c602cd25b524b87f64f89c4a9404e00926 100644 (file)
@@ -349,14 +349,19 @@ simplify_replace_rtx (x, old, new)
        }
       return x;
 
-    default:
-      if (GET_CODE (x) == MEM)
-       return
-         replace_equiv_address_nv (x,
-                                   simplify_replace_rtx (XEXP (x, 0),
-                                                         old, new));
+    case 'o':
+      if (code == MEM)
+       return replace_equiv_address_nv (x,
+                                        simplify_replace_rtx (XEXP (x, 0),
+                                                              old, new));
+
+      if (REG_P (x) && REG_P (old) && REGNO (x) == REGNO (old))
+       return new;
 
       return x;
+
+    default:
+      return x;
     }
   return x;
 }