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/97623] [9/10/11 Regression] Extremely slow O2 compile (>>O(n^2))
Date: Tue, 03 Nov 2020 14:16:17 +0000	[thread overview]
Message-ID: <bug-97623-4-ap6g87nKQ2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97623-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Wilson Snyder from comment #7)
> Thanks for the quick service.  I can't easily try GCC trunk, but:
> 
> -O2
>   compile 98.61s
>   runtime 25.76s
> 
> -O2 -fno-code-hoisting
>   compile 40.13s
>   runtime 26.40s (+2.5%)

Hmm, OK.  Can you provide the output of -O2 -fno-code-hoisting -ftime-report?

I have a patch limiting hoist insertions to 3 and that makes the reduced
testcase drop from 13s to 2.5s and drop PRE into reasonable territory:

 tree PRE                           :   0.44 ( 18%)   0.00 (  0%)   0.45 ( 18%)
 1177k (  5%)

and with -fno-code-hoisting

 tree PRE                           :   0.37 ( 15%)   0.00 (  0%)   0.38 ( 15%)
  477k (  2%)

where it takes only two insert iterations (the last iteration is always
a no-op, so that's perfect).  Before limiting but after the already
committed patch it was

 tree PRE                           :  10.41 ( 81%)   0.01 ( 33%)  10.48 ( 81%)
   11M ( 33%)

The function is quite big and ANTIC_IN compute is costly and more
importantly AVAIL_OUT is quadratic in size (ugh).

> -Os
>   compile 4.25s
>   runtime 23.42s (-10%)
> 
> That -Os runs faster is expected as this program is generally
> instruction-fetch limited.  I'd have expected -fno-code-hoisting to help
> more, compile time wise.

Me, too.

> Am I correct in understanding that the slowdown is roughly correlated to the
> number of "if" or "?:" statements?

Yeah, that's the case.

  parent reply	other threads:[~2020-11-03 14:16 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  2:02 [Bug c++/97623] New: " wsnyder at wsnyder dot org
2020-10-29  2:03 ` [Bug c++/97623] " wsnyder at wsnyder dot org
2020-10-29  7:17 ` [Bug tree-optimization/97623] [9/10/11 Regression] " rguenth at gcc dot gnu.org
2020-10-29  7:18 ` rguenth at gcc dot gnu.org
2020-10-30 12:35 ` rguenth at gcc dot gnu.org
2020-10-30 12:35 ` rguenth at gcc dot gnu.org
2020-10-30 13:25 ` cvs-commit at gcc dot gnu.org
2020-10-30 13:28 ` rguenth at gcc dot gnu.org
2020-10-30 13:55 ` wsnyder at wsnyder dot org
2020-11-03 14:16 ` rguenth at gcc dot gnu.org [this message]
2020-11-03 15:23 ` cvs-commit at gcc dot gnu.org
2020-11-06  1:50 ` wsnyder at wsnyder dot org
2020-11-06  9:52 ` rguenther at suse dot de
2020-11-06 12:37 ` wsnyder at wsnyder dot org
2020-11-06 13:00 ` rguenth at gcc dot gnu.org
2020-11-06 13:19 ` marxin at gcc dot gnu.org
2020-11-06 13:28 ` rguenth at gcc dot gnu.org
2020-11-06 13:45 ` rguenth at gcc dot gnu.org
2020-11-11 11:51 ` cvs-commit at gcc dot gnu.org
2020-11-11 16:11 ` tschwinge at gcc dot gnu.org
2020-11-11 17:17 ` cvs-commit at gcc dot gnu.org
2020-12-07 13:03 ` [Bug tree-optimization/97623] [9/10 " rguenth at gcc dot gnu.org
2021-01-11 13:37 ` cvs-commit at gcc dot gnu.org
2021-01-11 13:37 ` cvs-commit at gcc dot gnu.org
2021-01-11 13:39 ` [Bug tree-optimization/97623] [9 " rguenth at gcc dot gnu.org
2021-06-01  8:18 ` rguenth at gcc dot gnu.org
2022-05-27  8:56 ` 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-97623-4-ap6g87nKQ2@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).