Otimisation Problem


When optimiser set to level 9 (Common code block) calls to a certain function are getting optimised out.

The function takes a char pointer as an argument, and calculates a checksum from the 'pointed to' string, which gets appended to the end of the string (i.e the function will modify the string).

I'm assuming the compiler interprets this function call as redundant, although the body of the function isn't being optimised out...

Assuming there's nothing wrong with the function code (!) Why would the optimiser remove these calls, and how do I stop it...?

Thanks!

David

Parents
  • From the C51 manual:
    "Common Block Subroutines Detects recurring instruction sequences and converts them into subroutines. The compiler even rearranges code to obtain larger recurring sequences." (my emphasis)

    Are you sure the compiler is actually removing your calls, or is it just re-ordering them to somewhere else?

    Code can also seem to "disappear" with Reuse of Common Entry Code optimisation.

Reply
  • From the C51 manual:
    "Common Block Subroutines Detects recurring instruction sequences and converts them into subroutines. The compiler even rearranges code to obtain larger recurring sequences." (my emphasis)

    Are you sure the compiler is actually removing your calls, or is it just re-ordering them to somewhere else?

    Code can also seem to "disappear" with Reuse of Common Entry Code optimisation.

Children
More questions in this forum