Program Analysis
To correctly perform optimizations such as moving invariant code out of loops or reusing common subexpressions, it is necessary to have global information about the program.[This treatment follows Marvin Schaefer, A Mathematical Theory of Global Program Optimization, Prentice-Hall, 1973.]
Control flow analysis provides information about the potential control flow:
Data flow analysis provides information about the definition and use of variables and expressions. It can also detect certain types of programmer errors.