LTO and the inlining of functions only called once.

Richard Guenther richard.guenther@gmail.com
Sat Oct 10 15:10:00 GMT 2009


On Sat, Oct 10, 2009 at 3:40 PM, Toon Moene <toon@moene.org> wrote:
> Toon Moene wrote:
>
>> Richard Guenther wrote:
>
>>> Or rather for testing the effect of inlining all functions called once
>>> use the following
>>> patch:
>>>
>>> Index: ipa-inline.c
>>> ===================================================================
>>> --- ipa-inline.c    (revision 152615)
>>> +++ ipa-inline.c    (working copy)
>>> @@ -1249,8 +1249,8 @@ cgraph_decide_inlining (void)
>>>                node->callers->caller->global.size);
>>>         }
>>>
>>> -          if (cgraph_check_inline_limits (node->callers->caller, node,
>>> -                          NULL, false))
>>> +          if (1 || cgraph_check_inline_limits (node->callers->caller,
>>> node,
>>> +                           NULL, false))
>>>         {
>>>           cgraph_mark_inline (node->callers);
>>>           if (dump_file)
>>
>> Going this route, thanks !
>
> Well, this definitely wasn't the right approach - it made timing for a
> single integration time step in the model vary between 63 and 94 seconds.
>
> Without an explanation for that, this is not the way to go.
>
> However, that doesn't explain the (small) difference in size of the
> executables to me (given the large differences in code generation that
> should ensue):
>
> The two largest binaries without the above change to ipa-inline.c:
>
> -rwxr-xr-x 1 hirlam hirlam 9943616 2009-10-10 09:06 hirvda.x
> -rwxr-xr-x 1 hirlam hirlam 2306291 2009-10-10 09:04 hlprog.x
>
> their counterparts, after the above change:
>
> -rwxr-xr-x 1 hirlam hirlam 9943673 2009-10-10 14:40 hirvda.x
> -rwxr-xr-x 1 hirlam hirlam 2306219 2009-10-10 14:37 hlprog.x
>
> This doesn't scan.  In hlprog.x only, we're removing several hundreds of
>  arguments in argument lists, both in the calling routine and the callee.
>  This cannot just result in ~ 70 bytes of difference in code size.
>
> OK, for those sceptical, here are the results of size:
>
> Before the change:
>
>   text    data     bss     dec     hex filename
> 2254145    3592 186344080       188601817       b3dd5d9
> ../../../../../bin/hlprog.x
>
> After the change:
>
>   text    data     bss     dec     hex filename
> 2254113    3592 186344080       188601785       b3dd5b9 hlprog.x
>
> Something's rotten in the State of Denmark :-)

Well, it might simple be that even with our standard parameters full
inlining of functions called once already happens for you.

As honza said - the only real way to know is to look at the dumps,
-fdump-ipa-inline in this case, there should be a section titled
'Deciding on functions called once:'
and you can compare the differences with/without the patch.

Richard.



More information about the Gcc mailing list