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

Optimiser Problems - common block subroutines

Does any one else have problems with the higher levels of optimisation available to C51?

With common block subroutines switched on, sometimes, just sometimes, C51 will generate completely wrong code.

I have noticed that the problems are often associated with pointers that are automatic variables and where there is a variable of the same name in another function.

Common block subroutines have a dramatic affect on code size, but I don't use this level of optimisation because it just does not seem to be reliable.

Parents
  • Stefan: how well does each level of optimisation work? I performed an experiment using my current development project and built it with various possible levels of optimisation in order to find out. The project is pretty typical, it has no floating point and has ANSI promotion turned on for about 50% of the code. Linker code packing is enabled.

    Optimisation	Favour		Favour		Difference	Difference from level 8
    Level		Speed		Size		for size	Speed		Size
    8		59288		56882		4.06%		00.0%		00.0%
    9		49502		48358		2.31%		16.5%		15.0%
    10		49499		48417		2.18%		16.5%		14.9%
    11		49499		48417		2.18%		16.5%		14.9%
    
    The answer seems to be, that for my application, optimisation level 9 makes a very significant difference whereas levels 10 and 11 have very little to offer.

Reply
  • Stefan: how well does each level of optimisation work? I performed an experiment using my current development project and built it with various possible levels of optimisation in order to find out. The project is pretty typical, it has no floating point and has ANSI promotion turned on for about 50% of the code. Linker code packing is enabled.

    Optimisation	Favour		Favour		Difference	Difference from level 8
    Level		Speed		Size		for size	Speed		Size
    8		59288		56882		4.06%		00.0%		00.0%
    9		49502		48358		2.31%		16.5%		15.0%
    10		49499		48417		2.18%		16.5%		14.9%
    11		49499		48417		2.18%		16.5%		14.9%
    
    The answer seems to be, that for my application, optimisation level 9 makes a very significant difference whereas levels 10 and 11 have very little to offer.

Children
  • Graham,

    "whereas levels 10 and 11 have very little to offer"

    Indeed, you're seeing a slight increase in code size over level 9 with 'Favour size' as I am. My projects all use a great deal of floating point, I build with linker code packing on and integer promotion off.

    Perhaps Keil would like to comment on whether there are any specific situations where 10 and 11 make a significant improvement?

    Stefan