Method for optimizing a loop in a computer program by speculatively removing loads from within the loop
First Claim
Patent Images
1. A method of optimizing a loop in a computer program, the method comprising:
- (a) inserting an advance load statement that defines a temp with the value of a variable, the advance loading statement being inserted outside the loop;
(b) inserting a load check statement in the loop, the load check statement configured to(i) check whether the variable has been written to at any point between the advance load statement and the load check statement; and
(ii) if the variable has been written to, define the temp with a current value of the variable; and
(c) replacing a statement that occurs in the loop and that uses the variable with a statement that uses the temp.
1 Assignment
0 Petitions
Accused Products
Abstract
A method for optimizing a loop in a computer program. The loop contains at least a first statement that uses a variable. The method includes inserting a second statement that loads the variable. The second statement is inserted prior to the loop. The method also includes inserting a third statement that (i) checks whether the variable has been written to at any point between the second statement and the third statement and if and only if the variable has been written to, then loading the variable.
-
Citations
18 Claims
-
1. A method of optimizing a loop in a computer program, the method comprising:
-
(a) inserting an advance load statement that defines a temp with the value of a variable, the advance loading statement being inserted outside the loop; (b) inserting a load check statement in the loop, the load check statement configured to (i) check whether the variable has been written to at any point between the advance load statement and the load check statement; and (ii) if the variable has been written to, define the temp with a current value of the variable; and (c) replacing a statement that occurs in the loop and that uses the variable with a statement that uses the temp. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A method of optimizing a loop in a computer program, the loop containing a first statement that uses a rank-1 variable, the rank-1 variable containing a use of a rank-0 variable, the method comprising:
-
inserting a first advance load statement that defines a first temp with the value of the rank-0 variable, the first advance load statement being inserted outside of the loop; inserting a second advance load statement that defines a second temp with the value of rank-1 variable, the second advance load statement being inserted outside of the loop; inserting a first load check statement, the first load check statement configured to check whether the rank-0 variable has been written to at any point between the first advance load statement and the first load check statements and if the rank-0 variable has been written to, then redefine the first temp with a current value of the rank-0 variable and redefines said second temp with a current value of the rank-1 variable; inserting a second load check statement, the second load check statement configured to check whether the rank-1 variable has been written to at any point between the second advance load statement and the second load check statement and if the rank-1 variable has been written to, redefine the second temp with a current value of the rank-1 variable; and replacing the first statement with a second statement that uses the second temp. - View Dependent Claims (7, 8)
-
-
9. A computer readable medium, said computer readable medium containing a set of instructions for compiling a program loop in a computer program, which when executed by a computer processor, cause the processor to:
-
(a) insert an advance load statement that defines a temp with the value of a variable, the advance loading statement being inserted outside the loop; (b) insert a load check statement in the loop, the load check statement configured to (i) check whether the variable has been written to at any point between the advance load statement and the load check statement, and (ii) if the variable has been written to, define the temp with a current value of the variable; and (c) replace a statement that occurs in the loop and that uses the variable with a statement that uses the temp. - View Dependent Claims (10, 11, 12, 13)
-
-
14. A computer system for optimizing a loop in a computer program comprising:
-
a processor; and one or more storage devices, the storage devices having stored thereon sequences of instruction that when executed by the processor, cause the processor to, (a) insert an advance load statement that defines a temp with the value of a variable, the advance loading statement being inserted outside the loop, (b) insert a load check statement in the loop, the load check statement configured to (i) check whether the variable has been written to at any point between the advance load statement and the load check statement, and (ii) if the variable has been written to, then define the temp with a current value of the variable, and (c) replace a statement that occurs in the loop and that uses the variable with a statement that uses the temp. - View Dependent Claims (15, 16, 17, 18)
-
Specification