Patent ID: 9600254
Date: 2017-03-21
CPC Classifications: G06F

Claim:
1. A computer-implemented method of reducing loop branches comprising: analyzing an intermediate code corresponding to source code to be compiled to identify a candidate loop based at least in part on the loop including, within the loop, at least one candidate conditional statement, wherein the candidate conditional statement contains at least one mutable operand; analyzing a portion of the intermediate code to determine if a computation, which computes respective values of the mutable operand in the candidate conditional statement in iterations of the loop, is monotonic; in response to determining that the computation in the candidate conditional statement is monotonic, calculating an initial value of the mutable operand and a final value of the mutable operand; generating a first version of the candidate loop which does not contain the candidate conditional statement and which is configured to be executed if the initial value of the mutable operand and the final value of the mutable operand satisfy a range check; and generating a second version of the candidate loop which contains the candidate conditional statement and which is configured to be executed if at least one of the initial value of the mutable operand or the final value of the mutable operand does not satisfy the range check.