This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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

  • Please send an example of this problem to support@keil.com so we can figure out what's going on.

    Jon

  • 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.

  • David,

    Can you tell me the version numbers of the compiler and linker you are using? I have encountered a couple of optimisation problems when using c51 with the lx51 linker and suspect there may be more.

    Thanks,
    Dafydd

  • Sure!

    Compiler (c51) v6.23a
    Link/Loc (BL51) v4.23

    I'd appreciate any info on issues you may have encountered.

    Will respond to Keil support as soon as time permits

  • Valid addresses appear to be in existance for the function in question, as the emulator permits breakpoints to be set with in function body, but no actual calls to this function are 'breakpointable'.

    During execution, breakpoints which are set within the function body never halt execution, which leads me to suppose that the function is never called, as would be suggested by the unbreakpointable calls.
    However, I don't receive a linker warning message informing me that an uncalled function has been ignored for overlay purposes- Don't know if this is significant...

    David