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/57218] [4.8/4.9 Regression] Excessive inlining even at -Os
Date: Fri, 10 May 2013 08:49:00 -0000	[thread overview]
Message-ID: <bug-57218-4-a5C2xmnaV3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57218-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57218

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-05-10
                 CC|                            |hubicka at gcc dot gnu.org
   Target Milestone|---                         |4.8.1
            Summary|Excessive inlining even at  |[4.8/4.9 Regression]
                   |-Os                         |Excessive inlining even at
                   |                            |-Os
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

Deciding on inlining of small functions.  Starting with size 47.
Enqueueing calls of std.isra.0/8.
   Estimating body: std.isra.0/8
   Known to be false: not inlined, op1 changed, op2 changed
   size:11 time:20
   Estimating body: std.isra.0/8
   Known to be false: not inlined, op1 changed, op2 changed
   size:11 time:20
   Estimating body: std.isra.0/8
   Known to be false: not inlined, op1 changed, op2 changed
   size:11 time:20
  enqueuing call __sinit/1 -> std.isra.0/8, badness -36092160
  enqueuing call __sinit/1 -> std.isra.0/8, badness -36092160
  enqueuing call __sinit/1 -> std.isra.0/8, badness -36092160
Enqueueing calls of __sinit/1.
   Estimating body: std.isra.0/8
   Known to be false: not inlined, op1 changed, op2 changed
   size:11 time:20

Considering std.isra.0 with 21 size
 to be inlined into __sinit in newlib/libc/stdio/findfp.c:79
 Estimated growth after inlined into all is +0 insns.
 Estimated badness is -36092160, frequency 0.39.
    Badness calculation for __sinit/1 -> std.isra.0/8
      size growth 7, time 20  big_speedup
      -36092160: guessed profile. frequency 0.389000, benefit 23.529411%, time
w/o inlining 34, time w inlining 26 overall growth 0 (current) 0 (original)
                Accounting size:7.00, time:2.72 on predicate:(op0[ref offset:
640] == 0)
Processing frequency std.isra.0
  Called by __sinit that is normal or hot
 Inlined into __sinit which now has time 26 and size 33,net change of +7.


So the reason is that it can eliminate the body of 'std' after inlining
it three times and it computes that the cost of doing that (3 * 7 is
the same as the cost of the offline body).

And that's because

  ptr_1(D)->_p = 0B;
                freq:1.00 size:  1 time:  1
                50% will be eliminated by inlining
                Accounting size:0.50, time:0.50 on predicate:(not inlined)
                Accounting size:0.50, time:0.50 on predicate:(true)
  ptr_1(D)->_r = 0;
                freq:1.00 size:  1 time:  1
                50% will be eliminated by inlining
                Accounting size:0.50, time:0.50 on predicate:(not inlined)
                Accounting size:0.50, time:0.50 on predicate:(true)
...

the inliner thinks that it is likely that initializations via parameters
are eliminated by inlining:

Inline summary for std.isra.0/8 inlinable
  self time:       29
  global time:     0
  self size:       21
  global size:     0
  self stack:      0
  global stack:    0
    size:7.000000, time:7.000000, predicate:(true)
    size:10.000000, time:9.000000, predicate:(not inlined)
  calls:
    memset/3 function body not available
      loop depth: 0 freq:1000 size: 4 time: 13 callee size: 0 stack: 0
       op1 is compile time invariant
       op2 is compile time invariant

not sure why we have that (not inlined) predicate size stuff but use
'self size' when accounting against inlining multiple times.

The above seems to suggest that GCC will _always_ inline a function
with just initializers twice when the body can be eliminated then.


  reply	other threads:[~2013-05-10  8:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08 18:24 [Bug tree-optimization/57218] New: " amylaar at gcc dot gnu.org
2013-05-10  8:49 ` rguenth at gcc dot gnu.org [this message]
2013-05-10 10:49 ` [Bug tree-optimization/57218] [4.8/4.9 Regression] " hubicka at gcc dot gnu.org
2013-05-31 10:59 ` jakub at gcc dot gnu.org
2013-10-16  9:49 ` jakub at gcc dot gnu.org
2013-10-30 12:19 ` rguenth at gcc dot gnu.org
2014-05-22  9:04 ` [Bug tree-optimization/57218] [4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-12-19 13:28 ` [Bug tree-optimization/57218] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-06-23  8:20 ` [Bug tree-optimization/57218] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 19:57 ` [Bug tree-optimization/57218] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:27 ` jakub at gcc dot gnu.org
2020-03-12 11:58 ` [Bug ipa/57218] [8/9/10 " jakub at gcc dot gnu.org
2021-06-01  8:05 ` [Bug ipa/57218] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-09-05 17:24 ` pinskia at gcc dot gnu.org
2022-05-27  9:34 ` [Bug ipa/57218] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:29 ` [Bug ipa/57218] [11/12/13/14 " 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-57218-4-a5C2xmnaV3@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).