A method and apparatus for automatic second-order predictive commoning is
provided by the present invention. During an analysis phase, the
intermediate representation of a program code is analyzed to identify
opportunities for second-order predictive commoning optimization. The
analyzed information is used by the present invention for apply
transformations to the program code, such that the number of memory
access and the number of computations are reduced for loop iterations and
performance of program code is improved.