public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: GCC Mailing List <gcc@gcc.gnu.org>,
	"MacLeod, Andrew" <amacleod@redhat.com>
Subject: Re: 1.76% performance loss in VRP due to inlining
Date: Tue, 30 Apr 2024 09:57:55 +0200	[thread overview]
Message-ID: <CAFiYyc3=mLTK43VmHTeHyP2Hcxz8u6Tz+b2VFFVptQjaLbOEPg@mail.gmail.com> (raw)
In-Reply-To: <CAGm3qMVXdshX8T+ioAmEf2=5D8tzCHtZrmhzs0xcSTdUo0qCFg@mail.gmail.com>

On Fri, Apr 26, 2024 at 11:45 AM Aldy Hernandez via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hi folks!
>
> In implementing prange (pointer ranges), I have found a 1.74% slowdown
> in VRP, even without any code path actually using the code.  I have
> tracked this down to irange::get_bitmask() being compiled differently
> with and without the bare bones patch.  With the patch,
> irange::get_bitmask() has a lot of code inlined into it, particularly
> get_bitmask_from_range() and consequently the wide_int_storage code.
>
> I don't know whether this is expected behavior, and if it is, how to
> mitigate it.  I have tried declaring get_bitmask_from_range() inline,
> but that didn't help.  OTOH, using __attribute__((always_inline))
> helps a bit, but not entirely.  What does help is inlining
> irange::get_bitmask() entirely, but that seems like a big hammer.

You can use -Winline to see why we don't inline an inline declared
function.  I would guess the unit-growth limit kicks in?

Did you check a release checking compiler?  That might still
inline things.

> The overall slowdown in compilation is 0.26%, because VRP is a
> relatively fast pass, but a measurable pass slowdown is something we'd
> like to avoid.
>
> What's the recommended approach here?
>
> For the curious, I am attaching before and after copies of
> value-range.s.  I am also attaching the two patches needed to
> reproduce the problem on mainline.  The first patch is merely setup.
> It is the second patch that exhibits the problem.  Notice there are no
> uses of prange yet.
>
> Thanks.
> Aldy

  reply	other threads:[~2024-04-30  7:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  9:42 Aldy Hernandez
2024-04-30  7:57 ` Richard Biener [this message]
2024-04-30  8:21   ` Aldy Hernandez
2024-04-30  8:53 ` Martin Jambor
2024-04-30 19:09 ` Jason Merrill
2024-04-30 19:15   ` Richard Biener
2024-04-30 21:48     ` Building libgccjit with -fno-semantic-interposition? ( was Re: 1.76% performance loss in VRP due to inlining) David Malcolm
2024-05-02  7:40       ` Andrea Corallo
2024-04-30 19:22   ` 1.76% performance loss in VRP due to inlining Jakub Jelinek
2024-04-30 21:37     ` Jason Merrill
2024-05-03  8:55       ` Aldy Hernandez

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='CAFiYyc3=mLTK43VmHTeHyP2Hcxz8u6Tz+b2VFFVptQjaLbOEPg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc@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).