Expression Simplification

The expression simplification optimization attempts to replace arithmetic expressions with simpler expressions. Additionally, the compiler also looks for operations in expressions that can be avoided completely without affecting the final outcome of the expression. This optimization reduces size and increases speed.

The following table explains how to control the optimization for expression simplification.

Table 1. Controlling expression simplification
Turn control this option from here... use this setting
CodeWarrior IDE Choose Level 1, Level 2, Level 3, or Level 4 in the Optimization Level settings panel.
source code There is no pragma to control this optimization.
command line -opt level=1, -opt level=2, -opt level=3, -opt level=4

For example, the following listing contains a few assignments to some arithmetic expressions:

The following listing shows source code that is equivalent to expression simplification. The compiler has modified these assignments to: