public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ndesaulniers at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug gcov-profile/80223] RFE: Exclude functions from profile instrumentation
Date: Mon, 14 Jun 2021 20:46:31 +0000	[thread overview]
Message-ID: <bug-80223-4-7XgSNPjkzW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-80223-4@http.gcc.gnu.org/bugzilla/>

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

Nick Desaulniers <ndesaulniers at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |elver at google dot com,
                   |                            |isanbard at gmail dot com,
                   |                            |kees at outflux dot net,
                   |                            |maskray at google dot com,
                   |                            |ndesaulniers at google dot com

--- Comment #6 from Nick Desaulniers <ndesaulniers at google dot com> ---
We had a request for something like this today on LKML, see the thread.
https://lore.kernel.org/lkml/CAKwvOdmPTi93n2L0_yQkrzLdmpxzrOR7zggSzonyaw2PGshApw@mail.gmail.com/

And more specific use case:
https://lore.kernel.org/lkml/20210614190700.GF68749@worktop.programming.kicks-ass.net/

I've implemented this in LLVM; no_instrument_function function attribute in C
can be used to disable coverage of -fprofile-generate (instrumentation based
profiling; "PGO") and -fprofile-arcs (coverage; "GCOV").

PGO: https://reviews.llvm.org/D104253
GCOV: https://reviews.llvm.org/D104257

Inlining is a good point and something I'll need to check; generally when
caller's and callee's function attributes don't match, we block inline
substitution (though we permit it for always_inline; developer be damned).

One question Fangrui had made was whether no_instrument_function is the
appropriate function attribute to re-use.
https://reviews.llvm.org/D104253#2817695

It looks like both -finstrument-functions and -pg are affected by attribute
no_instrument_function; I decided to reuse no_instrument_function in LLVM
because:
1. it already exists; implementation is barely more than 1 LoC.
2. it already affects code gen of 2 different flags.
3. its name perfectly describes developer intent.
4. the Linux kernel is already wired up to make use of no_instrument_function
attribute (though the kernel's configuration step (KConfig) will need changes
to detect support for this issue probably).

I haven't landed the changes in LLVM yet, and don't particularly care what the
attribute used ultimately is even if that means revisting our approach in LLVM.

But without a solution to this problem, it's likely to block PGO and regress
GCOV for x86 Linux kernels.

       reply	other threads:[~2021-06-14 20:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-80223-4@http.gcc.gnu.org/bugzilla/>
2021-06-14 20:46 ` ndesaulniers at google dot com [this message]
2021-06-14 21:22 ` i at maskray dot me
2021-06-15 19:04 ` i at maskray dot me
2021-06-17 18:16 ` ndesaulniers at google dot com
2021-06-18 23:42 ` ndesaulniers at google dot com
2021-06-21  8:37 ` marxin at gcc dot gnu.org
2021-06-21 17:41 ` ndesaulniers at google dot com
2021-06-21 18:45 ` marxin at gcc dot gnu.org
2021-06-21 18:51 ` i at maskray dot me
2021-06-21 19:11 ` ndesaulniers at google dot com
2021-06-22 18:56 ` ndesaulniers at google dot com
2021-06-23 11:55 ` marxin at gcc dot gnu.org
2021-06-23 17:07 ` i at maskray dot me
2021-06-23 19:09 ` elver at google dot com
2021-06-23 19:51 ` i at maskray dot me
2021-06-23 20:09 ` i at maskray dot me
2021-06-24  7:28 ` marxin at gcc dot gnu.org
2021-06-24 19:20 ` ndesaulniers at google dot com
2021-09-07  9:48 ` cvs-commit at gcc dot gnu.org
2021-09-07  9:49 ` marxin 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-80223-4-7XgSNPjkzW@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).