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]
Other format: [Raw text]

Re: LTO question


On Tue, Oct 13, 2009 at 2:47 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
> Hello,
> I just had the first taste with the latest LTO merge on our port.
> Compiler is configured with LTO enabled and built correctly.
> I tried the following example:
>
> a.c
> extern void foo(int);
> int main()
> { ?foo(20);
> ?return 1;
> }
>
> b.c
> #include <stdio.h>
> void foo(int c)
> {
> ?printf("Hello world: %d\n", c);
> }
>
> compiled with:
> firepath-elf-gcc -flto a.c b.c -save-temps -O2
>
> I expected that foo should be inlined into main, but not. ?Both functions
> ?of main and foo are present in a.s, while b.s contains the LTO code.
>
> Did I miss something here? Are there new hooks I should specify or tune for
> LTO? I checked the up-to-date internal manual and found nothing.

non-inline declared functions are inlined at -O2 only if doing so
does not increase program size.  Use -O3 or -finline-functions.

Richard.

> Thanks,
> Bingfeng Mei
>
>
>


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