Re: [patch 00/2] improve .text size on gcc 4.0 and newer compilers

Arjan van de Ven
2006-01-02T19:54:35Z

On Mon, 2006-01-02 at 20:49 +0100, Krzysztof Halasa wrote:
> Arjan van de Ven <arjan@infradead.org> writes:
>
> > you know what? gcc inlines those automatic even without you typing
> > "inline". (esp if you have unit-at-a-time enabled)
>
> And if it's not or if it's an older gcc?

older than 3.0? that's not possible much longer

> > well.. gcc is not stupid, especially if you give it visibility by
> > enabling unit-at-a-time.
>
> A *.c author can't do that. Who knows what flags will be used?
>

the author should assume sane flags ;)

> > you save about 1 cycle by inlining unless there is a trick for the
> > optimizer.
>
> There probably is but even without further optimizations I still save
> at least that 1 cycle (and probably it caches better and have less stack
> impact etc).

actually that's no so sure. especially with the current regparm
callingconvention. Inlining will cause more spills, which causes more
stack usage. It's doubtful the extra space you use with "call" will
outweigh that.

> > Especially in the case you mention where gcc will dtrt...
> > it's not worth typing "inline", what if you change the code later to use
> > the function twice... most people at least forget to remove the
> > redundant inline, turning it into a bloater...
>
> I'd probably not forget that. BTW: most people don't write Linux.
> Still, in cases where there are only gains and nothing to lose, why
> not use some form of "inline"?

it's by far not only gains. And maintenance costs too.