LTO and the inlining of functions only called once.

Toon Moene toon@moene.org
Sat Oct 10 14:25:00 GMT 2009


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 :-)

-- 
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/
Progress of GNU Fortran: http://gcc.gnu.org/gcc-4.5/changes.html



More information about the Gcc mailing list