simplify-rtx.c (simplify_replace_rtx): Use rtx_equal_p for all OLD_RTXes, not just...
authorRichard Sandiford <rdsandiford@googlemail.com>
Sun, 11 Oct 2009 19:09:01 +0000 (19:09 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 11 Oct 2009 19:09:01 +0000 (19:09 +0000)
gcc/
* simplify-rtx.c (simplify_replace_rtx): Use rtx_equal_p for
all OLD_RTXes, not just REGs.  Use copy_rtx to create the
replacement value.

From-SVN: r152646

gcc/ChangeLog
gcc/simplify-rtx.c

index 2ebe6ca..ba83cf9 100644 (file)
@@ -1,3 +1,9 @@
+2009-10-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * simplify-rtx.c (simplify_replace_rtx): Use rtx_equal_p for
+       all OLD_RTXes, not just REGs.  Use copy_rtx to create the
+       replacement value.
+
 2009-10-11  Richard Guenther  <rguenther@suse.de>
 
        * gimple.c (iterative_hash_type_name): Do not handle special
index 0450ea0..4e87d04 100644 (file)
@@ -365,8 +365,8 @@ simplify_replace_rtx (rtx x, const_rtx old_rtx, rtx new_rtx)
      to build a new expression substituting recursively.  If we can't do
      anything, return our input.  */
 
-  if (x == old_rtx)
-    return new_rtx;
+  if (rtx_equal_p (x, old_rtx))
+    return copy_rtx (new_rtx);
 
   switch (GET_RTX_CLASS (code))
     {
@@ -445,11 +445,6 @@ simplify_replace_rtx (rtx x, const_rtx old_rtx, rtx new_rtx)
            return x;
          return gen_rtx_LO_SUM (mode, op0, op1);
        }
-      else if (code == REG)
-       {
-         if (rtx_equal_p (x, old_rtx))
-           return new_rtx;
-       }
       break;
 
     default: