public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59479] New: Inlining of static function bloats code size when Os
@ 2013-12-12  7:39 amker.cheng at gmail dot com
  2013-12-13 11:00 ` [Bug tree-optimization/59479] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: amker.cheng at gmail dot com @ 2013-12-12  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59479
           Summary: Inlining of static function bloats code size when Os
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amker.cheng at gmail dot com

Created attachment 31424
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31424&action=edit
The preprocessed file for newlib/libc/stdio/findfp.c

Hi, for attached preprocessed code from newlib/libc/stdio/findfp.c, GCC inlines
static function `std' even when optimizing for Os.
With command line:
$ ./arm-none-eabi-gcc -Os -mthumb -mcpu=cortex-m0 -c -xc findfp.E -o findfp.o

The dumped symbols are like:
    21: 00000009    16 FUNC    GLOBAL DEFAULT    1 _cleanup_r
    ...
    29: 00000055   224 FUNC    GLOBAL DEFAULT    1 __sinit
    ...
    41: 000001d5    24 FUNC    GLOBAL DEFAULT    1 __fp_unlock_all

With command line:
$ ./arm-none-eabi-gcc -Os -mthumb -mcpu=cortex-m0 -c -xc findfp.E -o findfp.o
-fno-inline

The dumped symbols are like:
     9: 00000018     0 NOTYPE  LOCAL  DEFAULT    1 $t
    10: 00000019    72 FUNC    LOCAL  DEFAULT    1 std.isra.0
    ...
    24: 00000009    16 FUNC    GLOBAL DEFAULT    1 _cleanup_r
    ...
    36: 0000009d    80 FUNC    GLOBAL DEFAULT    1 __sinit

This occurs on trunk and 4_8 branch.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/59479] Inlining of static function bloats code size when Os
  2013-12-12  7:39 [Bug tree-optimization/59479] New: Inlining of static function bloats code size when Os amker.cheng at gmail dot com
@ 2013-12-13 11:00 ` rguenth at gcc dot gnu.org
  2013-12-13 11:15 ` amker.cheng at gmail dot com
  2021-07-18 20:41 ` [Bug ipa/59479] " pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-12-13 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2013-12-13
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think you likely see a 2nd-order effect.  Inlining a once called function
should not increase code size.  But of course optimization opportunities
exposed by it may trigger optimizers that are not well tuned to honor -Os.

So, can you narrow down the issue a bit?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/59479] Inlining of static function bloats code size when Os
  2013-12-12  7:39 [Bug tree-optimization/59479] New: Inlining of static function bloats code size when Os amker.cheng at gmail dot com
  2013-12-13 11:00 ` [Bug tree-optimization/59479] " rguenth at gcc dot gnu.org
@ 2013-12-13 11:15 ` amker.cheng at gmail dot com
  2021-07-18 20:41 ` [Bug ipa/59479] " pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: amker.cheng at gmail dot com @ 2013-12-13 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from bin.cheng <amker.cheng at gmail dot com> ---
I will investigate it later.  Just clarifying, the function is called three
times by the caller, it would increase code size usually.

BTW, could you explain a little about "2nd-order effect"?  I am not familiar
with the concept.  Thanks in advance.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug ipa/59479] Inlining of static function bloats code size when Os
  2013-12-12  7:39 [Bug tree-optimization/59479] New: Inlining of static function bloats code size when Os amker.cheng at gmail dot com
  2013-12-13 11:00 ` [Bug tree-optimization/59479] " rguenth at gcc dot gnu.org
  2013-12-13 11:15 ` amker.cheng at gmail dot com
@ 2021-07-18 20:41 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-18 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
          Component|tree-optimization           |ipa

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Is there a misunderstanding of what called once means?  Does it mean only
called from one other function rather than one time?

I see std is called three times from __sinit rather than once in that function.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-18 20:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-12  7:39 [Bug tree-optimization/59479] New: Inlining of static function bloats code size when Os amker.cheng at gmail dot com
2013-12-13 11:00 ` [Bug tree-optimization/59479] " rguenth at gcc dot gnu.org
2013-12-13 11:15 ` amker.cheng at gmail dot com
2021-07-18 20:41 ` [Bug ipa/59479] " pinskia at gcc dot gnu.org

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).