This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -Os & inlining functions used only once


> >> -finline-functions seems a good candidate but it doesn't appear
> >> to works with -Os:
> >
> >If -Os is active and you also request inlining, the only functions that
> >get inlined are those that are so small that the inlined code is about the
> >same size as the code to pass the arguments and call the function (meaning
> >that we save space no matter how many copies we inline).

David Korn writes:
>   That is precisely the case here, since the inlined code amounts to
> replacing  "call _foo" with "movl $1,%eax".  If you replace -Os with -O,
> you get the expected results:

[ example deleted ]

Odd.  I've gotten inlining of small functions with -Os in the past.

On the other hand, that's for C++, for functions defined in the class
header and thus implicitly marked inline already.  I've never tested C.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]