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/109491] [11/12 Regression] Segfault in tree-ssa-sccvn.cc:expressions_equal_p()
Date: Fri, 14 Apr 2023 07:17:23 +0000	[thread overview]
Message-ID: <bug-109491-4-6cFmsHAeAg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109491-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Chip Kerchner from comment #12)
> > having always_inline across a deep call stack can exponentially increase compile-time
> 
> Do you think it would be worth requesting a feature to reduce the
> compilation times in situations like this?  Ideally exponentially is not a
> good thing.

Well, suppose you have

static __attribute__((always_inline)) inline void large_leaf () { /* large */ }

static __attribute__((always_inline)) inline void inter1 () { large_leaf (); }

static __attribute__((always_inline)) inline void inter2 () { inter1 (); inter1
(); }

static __attribute__((always_inline)) inline void inter3 () { inter2 (); inter2
(); }

void final () { inter3 (); inter3 (); }

then of course you end up with 8 copies of large_leaf in 'final' (you asked
for it).  Now, implementation wise it gets worse because we also fully
materialize the intermediate inter1, inter2 and inter3 with one and two
and four copies.  That's "only" double of the work but if it's single
call chains the overhead is larger.

There are specific cases where we could do better and IIRC some intermediate
updating of the costs blows up here as well (we build a "fat" callgraph
with inlined edges and inlined node clones).

In the end it requires somebody to sit down and see where to improve things
algorithmically - eventually eschewing the simple topological processing
for all inline candidates in favor of first resolving always-inlines in
the most optimal way, taking advantage of the fact that in principle
we do not need their bodies anymore.

I wasn't able to find a bug tracking this very specific issue so I created
one.  I have opened PR109509 for this.

  parent reply	other threads:[~2023-04-14  7:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 20:25 [Bug tree-optimization/109491] New: " pthaugen at gcc dot gnu.org
2023-04-12 20:26 ` [Bug tree-optimization/109491] [13 Regression] " pinskia at gcc dot gnu.org
2023-04-12 20:46 ` pthaugen at gcc dot gnu.org
2023-04-12 20:52 ` pinskia at gcc dot gnu.org
2023-04-12 20:54 ` pinskia at gcc dot gnu.org
2023-04-12 21:08 ` bergner at gcc dot gnu.org
2023-04-12 21:16 ` pthaugen at gcc dot gnu.org
2023-04-13 11:34 ` rguenth at gcc dot gnu.org
2023-04-13 11:35 ` rguenth at gcc dot gnu.org
2023-04-13 12:07 ` rguenth at gcc dot gnu.org
2023-04-13 12:17 ` rguenth at gcc dot gnu.org
2023-04-13 13:00 ` cvs-commit at gcc dot gnu.org
2023-04-13 13:01 ` [Bug tree-optimization/109491] [11/12 " rguenth at gcc dot gnu.org
2023-04-13 16:22 ` chip.kerchner at ibm dot com
2023-04-14  7:17 ` rguenth at gcc dot gnu.org [this message]
2023-04-14 12:24 ` chip.kerchner at ibm dot com
2023-04-14 12:45 ` rguenther at suse dot de
2023-04-14 13:15 ` rguenth at gcc dot gnu.org
2023-04-14 13:32 ` hubicka at gcc dot gnu.org
2023-04-17  9:14 ` cvs-commit at gcc dot gnu.org
2023-04-17 10:44 ` [Bug tree-optimization/109491] [11 " cvs-commit at gcc dot gnu.org
2023-04-17 10:46 ` 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-109491-4-6cFmsHAeAg@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).