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 ipa/113478] -Os does not inline single instruction function
Date: Thu, 18 Jan 2024 13:12:53 +0000	[thread overview]
Message-ID: <bug-113478-4-klEZcMlAMI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113478-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-01-18
                 CC|                            |hubicka at gcc dot gnu.org
          Component|c++                         |ipa

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
t.C:35:19: note: Considering inline candidate T D<T>::test() [with T =
char]/231.
   Estimating body: T D<T>::test() [with T = char]/231
   Known to be false: not inlined, op0 changed
   size:4
   Estimating body: T D<T>::test() [with T = char]/231
   Known to be false: not inlined, op0 changed
   size:4
t.C:35:19: missed:   will not early inline: int main()/185->T D<T>::test()
[with T = char]/231, call is cold and code would grow by 1

which is because

Analyzing function body size: T D<T>::test() [with T = char]/231
                Accounting size:2.00, time:0.00 on new predicate exec:(not
inlined)

 BB 2 predicate:(true)
  _3 = &MEM[(const struct __atomic_base *)this_1(D)]._M_i;
                freq:1.00 size:  0 time:  0
  _4 = __atomic_load_1 (_3, 0);
                freq:1.00 size:  4 time: 13
  _5 = (char) _4;
                freq:1.00 size:  0 time:  0
  return _5;
                freq:1.00 size:  1 time:  2
                Will be eliminated by inlining
                Accounting size:1.00, time:2.00 on predicate exec:(not inlined)

so the __atomic_load_1 "call"s are not special-cased during size estimation
and we assume you'd get parameter setup and call.  Note some targets
might expand this to a call to libatomic (there's also -finline-atomics).

We might want to consider improving heuristics here.

  reply	other threads:[~2024-01-18 13:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 12:56 [Bug c++/113478] New: " jari.helaakoski at qt dot io
2024-01-18 13:12 ` rguenth at gcc dot gnu.org [this message]
2024-01-19 10:51 ` [Bug ipa/113478] " hubicka at ucw dot cz
2024-01-19 11:09 ` rguenth at gcc dot gnu.org
2024-01-19 16:43 ` hubicka at ucw dot cz

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-113478-4-klEZcMlAMI@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).