public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/56113] out of memory when compiling a function with many goto labels (50k > )
Date: Fri, 01 Feb 2013 08:48:00 -0000	[thread overview]
Message-ID: <bug-56113-4-ry13brzEWb@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56113-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56113

--- Comment #25 from rguenther at suse dot de <rguenther at suse dot de> 2013-02-01 08:48:32 UTC ---
On Thu, 31 Jan 2013, steven at gcc dot gnu.org wrote:

> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56113
> 
> --- Comment #24 from Steven Bosscher <steven at gcc dot gnu.org> 2013-01-31 23:22:43 UTC ---
> (In reply to comment #23)
> > (In reply to comment #19)
> > > Created attachment 29317 [details]
> > > kill dominator queries from domwalk
> > > 
> > > This patch kills dominator queries from domwalk, removing a quadratic
> > > bottleneck
> > > I introduced there.  Do so by sorting DOM children after DFS completion
> > > numbers.
> > > 
> > > Which hopefully results in equivalent operation ;)
> 
> Another alternative would be to set up a vector with the edge counts
> at the start of the dominator walk.
> 
> When visiting a basic block bb, do
> 
>   FOR_EACH_EDGE (e, ei, bb->succs)
>     if (e->dest->index < unvisited_preds_count.length () // *
>         && (single_pred_p (e->dest) // common case, cheap test
>             || dominated_by_p (CDI_DOMINATORS, e->dest, e->src))
>       --unvisited_preds_count[e->dest]
> 
> and replace the expensive loop:
> 
>                 FOR_EACH_EDGE (e, ei, bb->preds)
>                   { 
>                     if (!dominated_by_p (CDI_DOMINATORS, e->src, e->dest)
>                         && !bitmap_bit_p (visited, e->src->index))
>                       { 
>                         found = false;
>                         break;
>                       }
>                   }
> 
> with:
> 
>                 if (e->dest->index < unvisited_preds_count.length () // *
>                     && unvisited_preds_count[e->dest->index] > 0)
>                   { 
>                     found = false;
>                     break;
>                   }

Yeah, I thought about such scheme but found the proposed patch
much better ;)

> (*) can go away if CFG modifications are forbidden during a domwalk,
> but that's for GCC 4.9 earliest.

But it seems the patch passed bootstrap & regtest ok ... I wonder
how CFG modifications would survive the current scheme - after all
we're using a visited sbitmap, too.  So it at least can't be allowed
to add basic-blocks during the domwalk.  Changing dominator
relationship with the proposed patch would only make the sorting
bogus (thus, back to "random", as it were before the issue
was introduced to domwalk which was rev. 159100).

So, I'm going to propose the patch nevertheless - did you spot
code that does CFG manipulations?  asan/tsan do not use domwalk
as far as I can see.

Richard.


  parent reply	other threads:[~2013-02-01  8:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25 20:37 [Bug c/56113] New: " aixer77 at gmail dot com
2013-01-25 20:39 ` [Bug c/56113] " aixer77 at gmail dot com
2013-01-26 15:29 ` [Bug middle-end/56113] " rguenth at gcc dot gnu.org
2013-01-26 15:40 ` aixer77 at gmail dot com
2013-01-27  0:17 ` steven at gcc dot gnu.org
2013-01-27 11:24 ` steven at gcc dot gnu.org
2013-01-27 13:27 ` steven at gcc dot gnu.org
2013-01-28  9:45 ` rguenth at gcc dot gnu.org
2013-01-28 10:05 ` rguenth at gcc dot gnu.org
2013-01-28 23:35 ` steven at gcc dot gnu.org
2013-01-29  9:52 ` rguenther at suse dot de
2013-01-29 13:07 ` rguenth at gcc dot gnu.org
2013-01-29 14:23 ` rguenth at gcc dot gnu.org
2013-01-29 14:24 ` rguenth at gcc dot gnu.org
2013-01-29 15:38 ` rguenth at gcc dot gnu.org
2013-01-30 13:50 ` rguenth at gcc dot gnu.org
2013-01-30 14:38 ` rguenth at gcc dot gnu.org
2013-01-30 15:41 ` rguenth at gcc dot gnu.org
2013-01-31 10:13 ` rguenth at gcc dot gnu.org
2013-01-31 16:37 ` rguenth at gcc dot gnu.org
2013-01-31 16:53 ` rguenth at gcc dot gnu.org
2013-01-31 19:56 ` steven at gcc dot gnu.org
2013-01-31 20:16 ` steven at gcc dot gnu.org
2013-01-31 22:51 ` steven at gcc dot gnu.org
2013-01-31 23:23 ` steven at gcc dot gnu.org
2013-02-01  8:48 ` rguenther at suse dot de [this message]
2013-02-01 10:10 ` rguenth at gcc dot gnu.org
2013-02-01 12:39 ` rguenth at gcc dot gnu.org
2013-02-04  9:30 ` rguenth at gcc dot gnu.org
2013-03-06 10:54 ` [Bug c/56113] " steven at gcc dot gnu.org
2013-03-18  8:48 ` rguenth at gcc dot gnu.org
2013-03-18 10:02 ` rguenth at gcc dot gnu.org
2013-04-08  8:37 ` [Bug middle-end/56113] " rguenth at gcc dot gnu.org
2023-05-04  9:29 ` [Bug c/56113] " rguenth at gcc dot gnu.org
2023-05-04 10:02 ` rguenth at gcc dot gnu.org
2023-05-04 10:54 ` 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-56113-4-ry13brzEWb@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).