public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/108500] [11/12 Regression] -O -finline-small-functions results in "internal compiler error: Segmentation fault" on a very large program (700k function calls)
Date: Thu, 02 Feb 2023 14:01:17 +0000	[thread overview]
Message-ID: <bug-108500-4-3AN27QdVxz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108500-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108500

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #14)
> Martin, can you look at the SRA issue?  Do you want me to create a separate
> bugreport for this?  The IL into SRA looks like
> 
>   <bb 2> :
>   s2D.2755 = {};
>   s1D.2756 = {};
>   _unusedD.2002766 = s1D.2756;
>   sD.2002767 = s2D.2755;
>   s2D.2755 = sD.2002767;
>   _unusedD.2002766 ={v} {CLOBBER(eol)};
>   sD.2002767 ={v} {CLOBBER(eol)};
>   _unusedD.2002764 = s1D.2756;
>   sD.2002765 = s2D.2755;
>   s2D.2755 = sD.2002765;
>   _unusedD.2002764 ={v} {CLOBBER(eol)};
>   sD.2002765 ={v} {CLOBBER(eol)};
>   _unusedD.2002762 = s1D.2756;
>   sD.2002763 = s2D.2755;
>   s2D.2755 = sD.2002763;
>   _unusedD.2002762 ={v} {CLOBBER(eol)};
>   sD.2002763 ={v} {CLOBBER(eol)};
>   _unusedD.2002760 = s1D.2756;
>   sD.2002761 = s2D.2755;
>   s2D.2755 = sD.2002761;
>   _unusedD.2002760 ={v} {CLOBBER(eol)};
>   sD.2002761 ={v} {CLOBBER(eol)};
> ...

struct s1 {
   char a[20] ;
   char b[20] ;
};
struct s2 {
   int id;
   char a[20];
};
static inline  __attribute__((always_inline)) struct s2
f(struct s1 _unused, struct s2 s)
{ 
  return s;
} 

volatile struct s2 x;
int main(void)
{
  struct s2 s2 = {0};
  struct s1 s1 = {0};
#define TEN \
  s2 = f(s1,s2); \
  s2 = f(s1,s2); \
  s2 = f(s1,s2); \
  s2 = f(s1,s2); \
  s2 = f(s1,s2); \
  s2 = f(s1,s2); \
  s2 = f(s1,s2); \
  s2 = f(s1,s2); \
  s2 = f(s1,s2); \
  s2 = f(s1,s2);
  TEN
  TEN
  x = s2;
  return 0;
}

shows this.  With

diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc
index ad0c738645d..ab3f47badcb 100644
--- a/gcc/tree-sra.cc
+++ b/gcc/tree-sra.cc
@@ -2980,6 +2980,7 @@ propagate_subaccesses_from_lhs (struct access *lacc,
struct access *racc)
 static void
 propagate_all_subaccesses (void)
 {
+  unsigned cnt = 0;
   propagation_budget = new hash_map<tree, unsigned>;
   while (rhs_work_queue_head)
     {
@@ -2994,6 +2995,7 @@ propagate_all_subaccesses (void)
        {
          struct access *lacc = link->lacc;

+         cnt++;
          if (!bitmap_bit_p (candidate_bitmap, DECL_UID (lacc->base)))
            continue;
          lacc = lacc->group_representative;
@@ -3019,6 +3021,7 @@ propagate_all_subaccesses (void)
            while (lacc);
        }
     }
+  fprintf (stderr, "%d\n", cnt);

   while (lhs_work_queue_head)
     {

we have with one TEN
> ./cc1 -quiet t.c -O
0
220
120

and with two TEN
> ./cc1 -quiet t.c -O
0
840
440

and with four TEN
> ./cc1 -quiet t.c -O
0
3280
1680

that's quadratic and has a quite high linear factor as well.

  parent reply	other threads:[~2023-02-02 14:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 17:30 [Bug c/108500] New: " dhekir at gmail dot com
2023-01-23 17:55 ` [Bug c/108500] " dhekir at gmail dot com
2023-01-24  2:57 ` [Bug ipa/108500] " pinskia at gcc dot gnu.org
2023-01-24  3:18 ` [Bug tree-optimization/108500] " pinskia at gcc dot gnu.org
2023-01-24  9:32 ` rguenth at gcc dot gnu.org
2023-01-24  9:43 ` rguenth at gcc dot gnu.org
2023-01-24  9:48 ` rguenth at gcc dot gnu.org
2023-01-24 12:36 ` [Bug tree-optimization/108500] [11/12/13 Regression] " rguenth at gcc dot gnu.org
2023-01-24 14:29 ` cvs-commit at gcc dot gnu.org
2023-01-24 14:30 ` [Bug tree-optimization/108500] [11/12 " rguenth at gcc dot gnu.org
2023-02-01  7:47 ` cvs-commit at gcc dot gnu.org
2023-02-01  8:42 ` rguenth at gcc dot gnu.org
2023-02-01 16:06 ` dhekir at gmail dot com
2023-02-01 16:07 ` dhekir at gmail dot com
2023-02-02 10:22 ` rguenth at gcc dot gnu.org
2023-02-02 10:34 ` rguenth at gcc dot gnu.org
2023-02-02 14:01 ` rguenth at gcc dot gnu.org [this message]
2023-02-02 17:12 ` dhekir at gmail dot com
2023-02-03  7:06 ` rguenth at gcc dot gnu.org
2023-02-03  8:20 ` rguenth at gcc dot gnu.org
2023-02-10 14:05 ` vmakarov at gcc dot gnu.org
2023-02-10 16:45 ` cvs-commit at gcc dot gnu.org
2023-02-13  7:42 ` rguenth at gcc dot gnu.org
2023-03-15  9:47 ` cvs-commit at gcc dot gnu.org
2023-03-15 10:03 ` [Bug tree-optimization/108500] [11 " rguenth at gcc dot gnu.org
2023-05-05  8:09 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108500-4-3AN27QdVxz@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).