Patent ID: 7213242

Claim:
A method to transform original code into optimized code, comprising: receiving original code; setting a flag with a value indicating the availability of a definition of the original code; inserting a guard around an instance of the definition, wherein the guard is capable of directing processing according to the value of the flag; removing an instruction that, at run-time, possibly throws an exception or fails to terminate; numbering each definition in an instruction associated with a node in a control flow graph established based on the original code to produce numbered definitions; performing flow analysis on the control flow graph to produce a first pair of values and a second pair of values with respect to each numbered definition in an instruction associated with a node in the control flow graph; and eliminating partial redundancy using both the first and the second pair of values, wherein the first pair of values corresponds to AVAILin and AVAILout indicating the availability of the value of the numbered definition before and after the instruction is executed, respectively, and the second pair of values corresponds to ANTICin, and ANTICout indicating whether the value of the numbered definition can be anticipated before and after the instruction is executed, respectively, and the values of AVAILin, AVAILout, ANTICin, and ANTICout include top, must, no, and may.