Local and Global Optimization
Local optimization is that which can
be done correctly
based on analysis of a small part of the program.
Examples:
L1: Goto L2
Global optimization requires information
about the whole program to be done correctly.
Example:
I * 8 ==> R1 = I * 8 ... ... I * 8 ==> R1This is correct only if I is not redefined between the two points. Doing optimization correctly requires program analysis: a special-purpose proof that program P' produces the same output values as P.