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 c++/105838] [10/11/12/13 Regression] g++ 12.1.0 runs out of memory or time when building const std::vector of std::strings
Date: Tue, 14 Jun 2022 13:10:17 +0000	[thread overview]
Message-ID: <bug-105838-4-FHowDn9C80@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105838-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|g++ 12.1.0 runs out of      |[10/11/12/13 Regression]
                   |memory or time when         |g++ 12.1.0 runs out of
                   |building const std::vector  |memory or time when
                   |of std::strings             |building const std::vector
                   |                            |of std::strings
             Blocks|                            |93199
   Target Milestone|---                         |10.4
           Priority|P3                          |P2
                 CC|                            |ebotcazou at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Memory usage is from cleanup_empty_eh_merge_phis which deals with a very large
number of incoming edges, recording the edge/var mappings.  This likely runs
into

  /* The post-order traversal may lead to quadraticness in the redirection
     of incoming EH edges from inner LPs, so first try to walk the region
     tree from inner to outer LPs in order to eliminate these edges.  */

where we end up re-directing more and more edges again and again.  Still the
peak memory use is odd, but it might be simply GC garbage piling up in the
CFG manipulation odyssee.

It's removal of MNT regions - with just 3 elements we go in ehcleanup1 from

Before removal of unreachable regions:
Eh tree:
   25 must_not_throw
   1 cleanup land:{12,<L26>}
     24 cleanup
     23 must_not_throw
     2 cleanup land:{11,<L25>}
       22 must_not_throw
       3 cleanup land:{10,<L18>}
         21 must_not_throw
         4 cleanup land:{9,<L17>}
           20 must_not_throw
           5 cleanup land:{1,<L16>}
             19 must_not_throw
             6 cleanup land:{8,<L15>}
               18 must_not_throw
               7 cleanup land:{2,<L14>}
                 17 must_not_throw
                 8 cleanup land:{7,<L13>}
                   16 must_not_throw
                   9 cleanup land:{3,<L12>}
                     15 must_not_throw
                     10 cleanup land:{6,<L8>}
                       14 must_not_throw
                       11 cleanup land:{5,<L7>}
                         13 must_not_throw
                         12 cleanup land:{4,<L6>}

to

After removal of unreachable regions:
Eh tree:
   1 cleanup land:{12,<L26>}
     2 cleanup land:{11,<L25>}
       3 cleanup land:{10,<L18>}
         4 cleanup land:{9,<L17>}
           5 cleanup land:{1,<L16>}
             6 cleanup land:{8,<L15>}
               7 cleanup land:{2,<L14>}
                 8 cleanup land:{7,<L13>}
                   9 cleanup land:{3,<L12>}
                     10 cleanup land:{6,<L8>}
                       11 cleanup land:{5,<L7>}
                         12 cleanup land:{4,<L6>}

but we do this in a sub-optimal order.  Axing the first walk:

  for (i = vec_safe_length (cfun->eh->lp_array) - 1; i >= 1; --i)
    {
      lp = (*cfun->eh->lp_array)[i];
      if (lp)
        changed |= cleanup_empty_eh (lp);
    }

fixes this but it will go against the PR93199 fix in r10-5868-g5eaf0c498f718f,
which the followup r11-3234-gaab6194d0898f5 preserved.  I fear the
optimal order is different for the clobber optimizations and the edge
redirection overhead.

In any case a fix should be evaluated against the PR93199 testcase as well.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93199
[Bug 93199] [9 Regression] Compile time hog in sink_clobbers

  parent reply	other threads:[~2022-06-14 13:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 16:22 [Bug c++/105838] New: " eisjmbjdfcukqlaely at nthrl dot com
2022-06-13 12:47 ` [Bug c++/105838] " rguenth at gcc dot gnu.org
2022-06-13 12:52 ` rguenth at gcc dot gnu.org
2022-06-14 11:56 ` rguenth at gcc dot gnu.org
2022-06-14 13:10 ` rguenth at gcc dot gnu.org [this message]
2022-06-14 13:11 ` [Bug c++/105838] [10/11/12/13 Regression] " rguenth at gcc dot gnu.org
2022-06-14 13:37 ` jakub at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2022-07-10 20:39 ` pinskia at gcc dot gnu.org
2022-07-11 15:43 ` luydorarko at vusra dot com
2022-12-05 17:57 ` jason at gcc dot gnu.org
2022-12-05 18:30 ` jakub at gcc dot gnu.org
2022-12-05 20:50 ` jason at gcc dot gnu.org
2022-12-05 20:58 ` jason at gcc dot gnu.org
2022-12-05 22:27 ` redi at gcc dot gnu.org
2022-12-05 22:34 ` jakub at gcc dot gnu.org
2022-12-05 23:57 ` jason at gcc dot gnu.org
2022-12-08 18:34 ` cvs-commit at gcc dot gnu.org
2022-12-08 18:41 ` cvs-commit at gcc dot gnu.org
2022-12-08 18:45 ` cvs-commit at gcc dot gnu.org
2022-12-15  5:26 ` cvs-commit at gcc dot gnu.org
2023-01-09 22:41 ` cvs-commit at gcc dot gnu.org
2023-06-02 15:01 ` [Bug c++/105838] [10/11/12/13/14 " cvs-commit at gcc dot gnu.org
2023-06-12  8:57 ` [Bug c++/105838] [10/11/12 " cvs-commit at gcc dot gnu.org
2023-07-07 10:43 ` [Bug c++/105838] [11/12 " rguenth at gcc dot gnu.org
2023-08-19  9:22 ` fxcoudert 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-105838-4-FHowDn9C80@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).