]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
emit-rtl.c (copy_rtx_if_shared): Don't allow MEMs with constant addresses to be shared.
authorRichard Sandiford <rsandifo@redhat.com>
Tue, 4 Nov 2003 09:14:18 +0000 (09:14 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 4 Nov 2003 09:14:18 +0000 (09:14 +0000)
* emit-rtl.c (copy_rtx_if_shared): Don't allow MEMs with constant
addresses to be shared.
(force_const_mem): Return a copy of the pool entry.

From-SVN: r73248

gcc/ChangeLog
gcc/emit-rtl.c
gcc/varasm.c

index c3af769271370941d3bdf1806d522b59df1aa123..e26d5c3ac59b7b45de36a3547cea7db1e491d73e 100644 (file)
@@ -1,3 +1,9 @@
+2003-11-04  Richard Sandiford  <rsandifo@redhat.com>
+
+       * emit-rtl.c (copy_rtx_if_shared): Don't allow MEMs with constant
+       addresses to be shared.
+       (force_const_mem): Return a copy of the pool entry.
+
 2003-11-03  Andreas Jaeger  <aj@suse.de>
 
        * Makefile.in (GCC_CFLAGS): Remove @WERROR@ again.
index 1f355e8a4005c160341e192b5c4603d4c8b5c0c1..9c50e2371fd6d78f9012423153bdf9eaa9e61fd0 100644 (file)
@@ -2690,20 +2690,6 @@ copy_rtx_if_shared (rtx orig)
       /* The chain of insns is not being copied.  */
       return x;
 
-    case MEM:
-      /* 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;
-
-      break;
-
     default:
       break;
     }
index 791b8ad0a9f0460e2312bc350fbb27f464430a82..21b76b9a59cb725401890ce1a42943d982303e20 100644 (file)
@@ -2915,7 +2915,7 @@ force_const_mem (enum machine_mode mode, rtx x)
   hash = const_hash_rtx (mode, x);
   for (desc = const_rtx_hash_table[hash]; desc; desc = desc->next)
     if (compare_constant_rtx (mode, x, desc))
-      return desc->rtl;
+      return copy_rtx (desc->rtl);
 
   /* No constant equal to X is known to have been output.
      Make a constant descriptor to enter X in the hash table
@@ -2983,7 +2983,7 @@ force_const_mem (enum machine_mode mode, rtx x)
   SYMBOL_REF_FLAGS (symbol) = SYMBOL_FLAG_LOCAL;
   current_function_uses_const_pool = 1;
 
-  return def;
+  return copy_rtx (def);
 }
 \f
 /* Given a SYMBOL_REF with CONSTANT_POOL_ADDRESS_P true, return a pointer to