re PR rtl-optimization/8634 (incorrect code for inlining of memcpy under -O2)
authorGlen Nakamura <glen@imodulo.com>
Mon, 7 Apr 2003 22:57:41 +0000 (22:57 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 7 Apr 2003 22:57:41 +0000 (15:57 -0700)
        PR opt/8634
        * explow.c (maybe_set_unchanging): Don't flag non-static const
        aggregate type initializers with RTX_UNCHANGING_P.

From-SVN: r65352

gcc/ChangeLog
gcc/explow.c

index b3cf6563425b43af741cffa73b1f20c6cd0ce80e..ac37bd265e830594e3b4646bb9cba66cac77d747 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-07  Glen Nakamura  <glen@imodulo.com>
+
+       PR opt/8634
+       * explow.c (maybe_set_unchanging): Don't flag non-static const
+       aggregate type initializers with RTX_UNCHANGING_P.
+
 2003-04-07  Richard Henderson  <rth@redhat.com>
 
         PR opt/8634
index 50556e8d6bf68eb69b64e6d491791632760a2147..9ed034eb1a986805143f4764c6e07b710c742374 100644 (file)
@@ -657,8 +657,18 @@ maybe_set_unchanging (ref, t)
   /* We can set RTX_UNCHANGING_P from TREE_READONLY for decls whose
      initialization is only executed once, or whose initializer always
      has the same value.  Currently we simplify this to PARM_DECLs in the
-     first case, and decls with TREE_CONSTANT initializers in the second.  */
+     first case, and decls with TREE_CONSTANT initializers in the second.
+
+     We cannot do this for non-static aggregates, because of the double
+     writes that can be generated by store_constructor, depending on the
+     contents of the initializer.  Yes, this does eliminate a good fraction
+     of the number of uses of RTX_UNCHANGING_P for a language like Ada.
+     It also eliminates a good quantity of bugs.  Let this be incentive to
+     eliminate RTX_UNCHANGING_P entirely in favour of a more reliable
+     solution, perhaps based on alias sets.  */
+
   if ((TREE_READONLY (t) && DECL_P (t)
+       && (TREE_STATIC (t) || ! AGGREGATE_TYPE_P (TREE_TYPE (t)))
        && (TREE_CODE (t) == PARM_DECL
           || (DECL_INITIAL (t) && TREE_CONSTANT (DECL_INITIAL (t)))))
       || TREE_CODE_CLASS (TREE_CODE (t)) == 'c')