Method and apparatus for inserting prefetch instructions in an executable
computer program. Profile data are generated for executed load instructions and
store instructions. The profile data include instruction addresses, target addresses,
data loaded and stored, and execution counts. From the profile data, recurring
patterns of instructions resulting in cache-miss conditions are identified. Prefetch
instructions are inserted prior to the instructions that result in cache-miss conditions
for patterns of instructions recurring more than a selected frequency.