Re: GCC 3.4 and broken inlining.

Arjan van de Ven
2004-07-10T06:33:20Z

[-- Attachment #1: Type: text/plain, Size: 850 bytes --]

On Sat, Jul 10, 2004 at 03:21:17AM +0200, Adrian Bunk wrote:
> > one thing to note is that you also need to monitor stack usage then :)
> > inlining somewhat blows up stack usage so do monitor it...
>
> How could inlining increase stack usage?

void foo1(void)
{
char array[200];
do_something(array);
}

void foo2(void)
{
char other_array[200];
do_somethingelse(other_array);
}

void function_to_which_they_inline(void)
{
foo1();
foo2();
}

(assume the do_* functions get inlined into foo or are defines or whatever)

without inlining it's clear that the max stack usage is 200, the lifetimes
of the 2 arrays are 100% exclusive.

With inlining, gcc reorders instructions in it's optimisation passes, and as
a result the lifetimes of the 2 arrays no longer are exclusive and as a
result gcc has no choice to have both separately on the stack.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]