- Branch optimization
- Rearranges the program code to minimize branching logic and to
physically separate blocks of code.
- Code motion
- If variables used in a computation within a loop are not altered
the loop, the calculation can be performed outside of the loop and the
used within the loop.
- Common subexpression
- In common expressions, the same value is recalculated in a
expression. The duplicate expression can be eliminated by using the
- Constant propagation
- Constants used in an expression are combined, and new ones are
Some implicit conversions between integers and floating-point types are
- Dead code elimination
- Eliminates code that cannot be reached or where the results are
- Dead store elimination
- Eliminates stores when the value stored is never referenced
example, if two stores to the same location have no intervening load,
first store is unnecessary and is removed.
- Global register
- Allocates variables and expressions to available hardware
a "graph coloring" algorithm.
- Replaces function calls with actual program code
- Instruction scheduling
- Reorders instructions to minimize execution time
- Interprocedural analysis
- Uncovers relationships across function calls, and eliminates
and computations that cannot be eliminated with more straightforward
- Invariant IF code
- Removes invariant branching code from loops to make more
- Rearranges the sequence of calculations in an array subscript
producing more candidates for common expression elimination.
- Store motion
- Moves store instructions out of loops.
- Strength Reduction
- Replaces less efficient instructions with more efficient ones.
in array subscripting, an add instruction replaces a multiply
- Value numbering
- Involves constant propagation, expression elimination, and
several instructions into a single instruction.