A computer program product comprising a computer usable medium having computer readable program code means embodied in said medium for causing an application program to execute on a computer that performs speculative code motion within a single static form partial redundancy elimination (SSAPRE) optimization, within an compiler, said computer readable program code means comprising:
- a first computer readable program code means for causing the computer to access a static single assignment (SSA) representation of a computer program;
- a second computer readable program code means for causing the computer to obtain an SSA graph of the hypothetical variable from said SSA representation of said computer program, wherein said SSA graph comprises a plurality of connected components;
- a third computer readable program code means for causing the computer to use a heuristic to determine a plurality of points to enable speculation within each of said plurality of connected components of said SSA graph;
- and
- a fourth computer readable program code means for causing the computer to perform the SSAPRE optimization whereby setting a down.sub.-- safety flag to true for a .PHI. function of each of said determined plurality of points within each of said plurality of connected components of said SSA graph;
- whereby the compiler can produce more efficient executable program code from said SSA graph by speculating at each of said determined plurality of points where said down safety flag is true.