public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Erick Ochoa <eochoa@gcc.gnu.org>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Development <gcc@gcc.gnu.org>
Subject: Re: Creating a wrapper around a function at compile time
Date: Thu, 14 Jul 2022 16:08:33 +0200	[thread overview]
Message-ID: <CAJ_nqzj-R8iooS2_h0ndEu_KVg4Wn=-2vM7V8cWHWn62SpTQtg@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc0tfFuWUk9G0dt_NakFtR3VBjkEun2Ngv49vjzsgowCew@mail.gmail.com>

On Thu, 14 Jul 2022 at 15:51, Richard Biener <richard.guenther@gmail.com>
wrote:

> With a value-profile it would be per call site and IPA-CP can use that
> to direct the cloning.  I'm not sure how many
> values a value histogram can track reliably here.
>

Last time I checked, value profiling can only track a single value per
statement. So that would need to be augmented if we wanted to specialize
for more than one parameter. However, this can also be a bad idea. Because
even if parameters a and b are quasi-constants, perhaps the cross product a
x b follows a more uniform distribution. This means that optimizing on a or
on b might be a good idea but optimizing on a x b is a bad idea. (There is
still some work to be done defining when specializing is a good idea or
not). Also, I do not believe that value profiling profiles arguments?
According to the comments only values regarding division and/or
indirect/virtual call specialization are tracked during value profiling.

However, even if value profiling would be a great addition to this, I would
like to explore the transformation independent of value profiling. There
are some heuristics that could be used, for example looking at the
callsites which do have constant arguments and which optimizations are
enabled by those constants.

You mention that: "IPA-CP can use that to direct the cloning". Can you
elaborate a bit further? I guess the idea here is augmenting ipa-cp with a
list of "likely values" and extend the infrastructure which deals with
speculation to support arguments. Am I following correctly? Any other
suggestions?

  reply	other threads:[~2022-07-14 14:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 12:38 Erick Ochoa
2022-07-14 13:27 ` Richard Biener
2022-07-14 13:29   ` Richard Biener
2022-07-14 13:46     ` Erick Ochoa
2022-07-14 13:50       ` Richard Biener
2022-07-14 14:08         ` Erick Ochoa [this message]
2022-07-14 14:10           ` Martin Liška
2022-07-14 14:25             ` Erick Ochoa
2022-07-15  8:10               ` Martin Liška
2022-07-15  8:33                 ` Erick Ochoa

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='CAJ_nqzj-R8iooS2_h0ndEu_KVg4Wn=-2vM7V8cWHWn62SpTQtg@mail.gmail.com' \
    --to=eochoa@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).