Optimising for size

Hariharan hariharans@picochip.com
Tue Jul 15 10:11:00 GMT 2008


Hi Joel,
I ran into a similar problem moving from 4.2.2 to 4.3.0. I looked a bit 
into it and found that 4.3 compiler inlines more aggressively than 4.2.x 
compiler. The reason was that the following two lines were removed from 
opts.c

       set_param_value ("max-inline-insns-single", 5); 
 

       set_param_value ("max-inline-insns-auto", 5);

Of course, there were other changes made to make sure code size didnt 
increase with this change. But, the other changes depend on 
PARAM_INLINE_CALL_COST. The default of 16 was too high for our target 
(picochip). You might want to try to reduce this value and see if your 
code-size woes go away.


Regards
Hari

Joe Buck wrote:

     On Mon, Jul 14, 2008 at 10:04:08AM +1000, zoltan@bendor.com.au wrote:

         I have a piece of C code. The code, compiled to an ARM THUMB 
target using
         gcc 4.0.2, with -Os results in 230 instructions. The exact same 
code,
         using the exact same switches compiles to 437 instructions with 
gcc 4.3.1.
         Considering that the compiler optimises to size and the much newer
         compiler emits almost twice as much code as the old one, I 
think it is an
         issue.


     Agreed.  I think it's a regression.  Using -Os and getting
     much larger code would qualify.


         So the question is, how should I report it?


     Open a PR with the complete test case, and the command line options you
     used with 4.0.2 and 4.3.1.


Please cc me on the PR.  I would like to track this one and
if you provide a preprocessed  test case can quickly
check the size on 3.2.3, 4.1.1, 4.2.4, 4.3.1 and the trunk.


Use joel AT gcc DOT gnu.org

Thanks.

--
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



More information about the Gcc mailing list