]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport a fix that restricts sharing of some MEMs.
authorBernd Schmidt <bernds@redhat.co.uk>
Mon, 18 Dec 2000 14:37:37 +0000 (14:37 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Mon, 18 Dec 2000 14:37:37 +0000 (14:37 +0000)
From-SVN: r38350

gcc/ChangeLog
gcc/emit-rtl.c

index 9ced870d7e6007d0336b174d262d57a7b0bfb13c..7334ad2af7de48f71f158bc2ae7f9073e0b18a6c 100644 (file)
@@ -1,5 +1,10 @@
 2000-12-18  Bernd Schmidt  <bernds@redhat.co.uk>
 
+       Mon Aug 30 01:02:09 1999  Jeffrey A Law  (law@cygnus.com)
+       * emit-rtl.c (copy_rtx_if_shared): A MEM which references
+       virtual_stack_vars_rtx or virtual_incoming_args_rtx can not
+       be shared.
+
        2000-03-24  Geoff Keating  <geoffk@cygnus.com>
        * flow.c (propagate_block): When we delete an ADDR_VEC,
        also delete the BARRIER following it if there is one.
index 222a1a937f096b24f1a6a5f650ed69957d7c65b1..54cee163738a0f38f37850ec4ac82597ca8e1545 100644 (file)
@@ -1847,25 +1847,17 @@ copy_rtx_if_shared (orig)
       return x;
 
     case MEM:
-      /* A MEM is allowed to be shared if its address is constant
-        or is a constant plus one of the special registers.  */
-      if (CONSTANT_ADDRESS_P (XEXP (x, 0))
-         || XEXP (x, 0) == virtual_stack_vars_rtx
-         || XEXP (x, 0) == virtual_incoming_args_rtx)
+      /* A MEM is allowed to be shared if its address is constant.
+
+        We used to allow sharing of MEMs which referenced 
+        virtual_stack_vars_rtx or virtual_incoming_args_rtx, but
+        that can lose.  instantiate_virtual_regs will not unshare
+        the MEMs, and combine may change the structure of the address
+        because it looks safe and profitable in one context, but
+        in some other context it creates unrecognizable RTL.  */
+      if (CONSTANT_ADDRESS_P (XEXP (x, 0)))
        return x;
 
-      if (GET_CODE (XEXP (x, 0)) == PLUS
-         && (XEXP (XEXP (x, 0), 0) == virtual_stack_vars_rtx
-             || XEXP (XEXP (x, 0), 0) == virtual_incoming_args_rtx)
-         && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1)))
-       {
-         /* This MEM can appear in more than one place,
-            but its address better not be shared with anything else.  */
-         if (! x->used)
-           XEXP (x, 0) = copy_rtx_if_shared (XEXP (x, 0));
-         x->used = 1;
-         return x;
-       }
       break;
 
     default: