re PR rtl-optimization/8634 (incorrect code for inlining of memcpy under -O2)
authorRichard Henderson <rth@redhat.com>
Mon, 7 Apr 2003 22:05:49 +0000 (15:05 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 7 Apr 2003 22:05:49 +0000 (15:05 -0700)
        PR opt/8634
        * function.c (purge_addressof_1): Don't try arithmetics for
        unchanging memories.

From-SVN: r65351

gcc/ChangeLog
gcc/function.c

index 841d6ad4b71aac6804fc705c5272fa63be6d9cf6..b3cf6563425b43af741cffa73b1f20c6cd0ce80e 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-07  Richard Henderson  <rth@redhat.com>
+
+        PR opt/8634
+        * function.c (purge_addressof_1): Don't try arithmetics for
+        unchanging memories.
+
 2003-04-07  Janis Johnson  <janis187@us.ibm.com>
 
        * doc/sourcebuild.texi (Test Suites): Document testing support for
index 40186b04a995b49daee384482749a859a3c9b7c6..0b4f93fa6278e5f31b44d29a6db58b641afcb5a9 100644 (file)
@@ -3140,10 +3140,16 @@ purge_addressof_1 (loc, insn, force, store, ht)
          size_x = GET_MODE_BITSIZE (GET_MODE (x));
          size_sub = GET_MODE_BITSIZE (GET_MODE (sub));
 
+         /* Do not frob unchanging MEMs.  If a later reference forces the
+            pseudo to the stack, we can wind up with multiple writes to
+            an unchanging memory, which is invalid.  */
+         if (RTX_UNCHANGING_P (x) && size_x != size_sub)
+           ;
+
          /* Don't even consider working with paradoxical subregs,
             or the moral equivalent seen here.  */
-         if (size_x <= size_sub
-             && int_mode_for_mode (GET_MODE (sub)) != BLKmode)
+         else if (size_x <= size_sub
+                  && int_mode_for_mode (GET_MODE (sub)) != BLKmode)
            {
              /* Do a bitfield insertion to mirror what would happen
                 in memory.  */