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: Sigh. Inlining heuristics.



On 10 Jul 2001, Alexandre Oliva wrote:
>
> We already do.  My proposal is only for the default value.  And it's
> hard to tell whether it's really going to give worse performance.
> There's a cache hit, indeed, if you inline the same large function
> into multiple other functions, but if you call it only once, and you
> get it inlined, you'd be saving the function-call overhead without any
> cache hit

Nope.

The way gcc currently generates code, you'll often get _worse_ code from
inlining, because it often adds register pressure when gcc decides to keep
stuff live for long stretches. Very noticeable on x86 with the few
registers - you can get into stack slot reload hell, causing much worse
code generation than if you didn't inline.

So when you inline, you quite often
 - make code bigger
 - make code _slower_ than if you just had a "call"
 - make the compile slower

Ie you have _no_ gains anywhere.

So you really shouldn't inline too aggressively. (The new register-
allocator branch may fix most of the code generation issue. At least I
_hope_ it will fix the register allocation issues gcc has some day).

		Linus


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