Optimizing code by exploiting speculation and predication with a cost-benefit data flow analysis based on path profiling information
First Claim
1. A computer implemented method for optimizing execution of code, said code including a plurality of instructions, said method comprising:
- executing said code to generate path profiling information;
identifying at least one location for relocating at least one of said plurality of instructions, said at least one location enabled by one of predication and speculation;
calculating a cost and a benefit for relocating said at least one of said plurality of instructions to said at least one location, said cost and said benefit based on said path profiling information;
moving said at least one of said plurality of instructions to said at least one location when said benefit exceeds said cost;
performing one of said speculation and said predication on said at least one of said plurality of instructions; and
re-executing said code.
2 Assignments
0 Petitions
Accused Products
Abstract
A method and apparatus for optimizing execution of code is disclosed. The code is executed to generate path profiling information. At least one location is identified for relocating at least one of the plurality of instructions in the code, where the at least one location is enabled by one of predication and speculation. A cost and a benefit are calculated for relocating the at least one of the plurality of instructions to the at least one location, the cost and the benefit based on the path profiling information. The at least one of the plurality of instructions is moved to the at least one location when the benefit exceeds the cost, and one of predication and speculation is performed on the one of the plurality of instructions. The code is then reexecuted.
83 Citations
14 Claims
-
1. A computer implemented method for optimizing execution of code, said code including a plurality of instructions, said method comprising:
-
executing said code to generate path profiling information; identifying at least one location for relocating at least one of said plurality of instructions, said at least one location enabled by one of predication and speculation; calculating a cost and a benefit for relocating said at least one of said plurality of instructions to said at least one location, said cost and said benefit based on said path profiling information; moving said at least one of said plurality of instructions to said at least one location when said benefit exceeds said cost; performing one of said speculation and said predication on said at least one of said plurality of instructions; and re-executing said code. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A computer implemented method for eliminating a partially redundant instruction in a program, said program including a plurality of paths, said method comprising:
-
identifying at least one location for relocating said partially redundant instruction, said at least one location enabled by speculation; examining path profile information for each of said plurality of paths; generating cost-benefit data for each of said plurality of paths, said cost-benefit data being based on said path profile information; hoisting said partially redundant instruction to said at least one location based on said cost-benefit data; performing said speculation on said partially redundant instruction.
-
-
7. A computer implemented method for eliminating a partially dead instruction in a program, said program including a plurality of paths, said method comprising:
-
identifying at least one location for relocating said partially dead instruction, said at least one location enabled by predication; examining path profile information for each of said plurality of paths; generating cost-benefit data for each of said plurality of paths, said cost-benefit data being based on said path profile information; sinking said partially dead instruction to a pre-determined location based on said cost-benefit data; and performing said predication on said partially dead instruction.
-
-
8. A machine readable medium having stored thereon data representing sequences of instructions, which when executed by a computer system, cause said computer system to perform the steps of:
-
executing said code to generate path profiling information; identifying at least one location for relocating at least one of a plurality of instructions in code, said at least one location enabled by one of predication and speculation; calculating a cost and a benefit for relocating said at least one of said plurality of instructions to said at least one location, said cost and said benefit based on said path profiling information; moving said at least one of said plurality of instructions to said at least one location when said benefit exceeds said cost; performing one of said speculation and said predication on said at least one of said plurality of instructions; and re-executing said code. - View Dependent Claims (9, 10, 11, 12)
-
-
13. A machine readable medium having stored thereon data representing sequences of instructions, which when executed by a computer system, cause said computer system to perform the steps of:
-
identifying at least one location for relocating a partially redundant instruction in a program having a plurality of paths, said at least one location enabled by speculation; examining path profile information for each of said plurality of paths; generating cost-benefit data for each of said plurality of paths, said cost-benefit data being based on said path profile information; hoisting said partially redundant instruction to said at least one location based on said cost-benefit data; performing said speculation on said partially redundant instruction.
-
-
14. A machine readable medium having stored thereon data representing sequences of instructions, which when executed by a computer system, cause said computer system to perform the steps of:
-
identifying at least one location for relocating a partially dead instruction in a program having a plurality of paths, said at least one location enabled by predication; examining path profile information for each of said plurality of paths; generating cost-benefit data for each of said plurality of paths, said cost-benefit data being based on said path profile information; sinking said partially dead instruction to a pre-determined location based on said cost-benefit data; and performing said predication on said partially dead instruction.
-
Specification