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.

TMS570LC4357: Question on optimization -O0 for ARM compiler 5.1.6

Part Number: TMS570LC4357

Hi Experts,

The documentation for the ARM Compiler 5.1.6 (SPNU151I) indicates that when using -O0 optimization the compiler will simplify expressions and statements. Are the changes introduced by optimization the same for similar code structures? Or the output of the compiler might not be deterministic?

(The reason is that we need to validate for our program that the output of the compiler is correct. When no optimization is used, a sample of the code is enough to verify that the compiler output is fine, but if the output might change for similar code structures, then an analysis of the compiler output for the complete code would be needed. )

Regards,

Jose Abea

  • Hi Jose,

    1. Regarding Expression Simplification at -O0:
    • At optimization level -O0, the compiler does perform some basic expression simplification, but these optimizations are minimal and generally deterministic for identical code structures.
    • The simplifications at -O0 are primarily focused on basic constant folding and straightforward expression reduction that don't change the logical structure of the code.
    1. Deterministic Behavior:
    • Compiler output can have some variations, but these are typically related to debug information and metadata rather than actual code generation.
    • When comparing actual executable code (rather than the complete output file), the compiler's behavior at -O0 should be deterministic for identical code structures.

    --
    Thanks & regards,
    Jagadish.