public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-809] Revert "tree-sra: Avoid refreshing into const base decls (PR 100453)"
@ 2021-05-15  8:28 Martin Jambor
  0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2021-05-15  8:28 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:af42043e6618e69187b47f37dac870763c01e20f

commit r12-809-gaf42043e6618e69187b47f37dac870763c01e20f
Author: Martin Jambor <mjambor@suse.cz>
Date:   Sat May 15 10:11:12 2021 +0200

    Revert "tree-sra: Avoid refreshing into const base decls (PR 100453)"
    
    This reverts commit ca9bb74a5f856ccdceb4797f18b0a4ac8f49d069.
    ...because of Ada issues I did not catch with original testing.
    
    gcc/ChangeLog:
    
    2021-05-12  Martin Jambor  <mjambor@suse.cz>
    
            Revert:
            PR tree-optimization/100453
            * tree-sra.c (sra_modify_assign): All const base accesses do not
            need refreshing, not just those from decl_pool.
            (sra_modify_assign): Do not refresh into a const base decl.
    
    gcc/testsuite/ChangeLog:
    
    2021-05-12  Martin Jambor  <mjambor@suse.cz>
    
            Revert:
            PR tree-optimization/100453
            * gcc.dg/tree-ssa/pr100453.c: New test.

Diff:
---
 gcc/testsuite/gcc.dg/tree-ssa/pr100453.c | 18 ------------------
 gcc/tree-sra.c                           |  4 ++--
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c
deleted file mode 100644
index 0cf0ad23815..00000000000
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr100453.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* { dg-do run } */
-/* { dg-options "-O1" } */
-
-struct a {
-  int b : 4;
-} d;
-static int c, e;
-static const struct a f;
-static void g(const struct a h) {
-  for (; c < 1; c++)
-    d = h;
-  e = h.b;
-  c = h.b;
-}
-int main() {
-  g(f);
-  return 0;
-}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 186cd62b476..8dfc923ed7e 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4244,7 +4244,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi)
       || stmt_ends_bb_p (stmt))
     {
       /* No need to copy into a constant-pool, it comes pre-initialized.  */
-      if (access_has_children_p (racc) && !TREE_READONLY (racc->base))
+      if (access_has_children_p (racc) && !constant_decl_p (racc->base))
 	generate_subtree_copies (racc->first_child, rhs, racc->offset, 0, 0,
 				 gsi, false, false, loc);
       if (access_has_children_p (lacc))
@@ -4333,7 +4333,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi)
 	    }
 	  /* Restore the aggregate RHS from its components so the
 	     prevailing aggregate copy does the right thing.  */
-	  if (access_has_children_p (racc) && !TREE_READONLY (racc->base))
+	  if (access_has_children_p (racc))
 	    generate_subtree_copies (racc->first_child, rhs, racc->offset, 0, 0,
 				     gsi, false, false, loc);
 	  /* Re-load the components of the aggregate copy destination.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-15  8:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15  8:28 [gcc r12-809] Revert "tree-sra: Avoid refreshing into const base decls (PR 100453)" Martin Jambor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).