Patent ID: 8291397

Claim:
A method, in a data processing system, for compiling computer code, comprising: for a function called by computer code, generating at least two variants for the function; storing the at least two variants for the function in a variant storage device, wherein a first variant for the function of the at least two variants comprises first code of the function that is unchanged from an original version of the code for the function, and wherein a second variant for the function of the at least two variants comprises second code of the function in which return value code directed to generating a return value is removed from the code of the function; performing return-value analysis on a function call, for calling the function, within original computer code to select a variant for the function of the at least two variants to use for the function call; retrieving, from the variant storage device, the selected variant for the function of the at least two variants; and modifying the function call in the original computer code, to generate modified computer code, based on results of the return-value analysis identifying which variant for the function of the at least two variants for the function to use for the function call, wherein: performing return-value analysis on the function call within the original computer code comprises: analyzing the function call to determine if the return value of the function is used by the original computer code; and selecting a corresponding variant for the function, of the at least two variants, to replace the function call based on results of the return-value analysis, and modifying the function call comprises inline expanding the function call by incorporating code of the selected variant for the function of the at least two variants into the modified computer code.