A method for code optimization includes disassembling object code that has been
compiled and linked, and identifying a function in the disassembled code, the function
including store and restore instructions with respect to a register. The disassembled
code is analyzed to locate a call to the function followed by an instruction to
kill the register. The code is modified so as to eliminate the store instruction
from the function when the function is invoked by the located call.