-Os & inlining functions used only once

Joe Buck jbuck@racerx.synopsys.com
Tue Apr 17 11:52:00 GMT 2001


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



More information about the Gcc mailing list