This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS4 latest compiler not optimizing code

I ran a test where I change the optimization level from 0 to 2.  I look at the link file before and afer the code size did not change.   Is there another setting to allow optimization? 

 

  • That might be an indication that nothing to be "optimized" (which in turn means you wrote very efficient code). you can try adding some castings, intermediate variables to see the effect. 

    Leong

  • The optimizer is not a magic bullet.  It follows certain steps to optimize code (see page 48 of the C/C++ Compiler guide).  If there are none of the things that can be optimized out in your code, nothing will change.

    A couple of other points/questions:

    1) How big is the code you are optimizing?  The bigger the code is the greater the chance of it finding something to be optimized.

    2) Optimization Level 0 is already optimizing.  Sticking it to O2 does a few more things, and as stated above these may not be in your code.  Have a go at turning optimization off completely (in the project build settings) and then seeing whether your map file has changed (code size has got bigger).  This is more likely to show a change and indicate that there is something happening in optimization.

    Tim