A computer-implemented method for improving the control flow of a software program, the computer-implemented method being performed by one or more processors executing computer executable instructions for the computer-implemented method, and the computer-implemented method comprising: traversing a control flow graph corresponding to the control flow of the software program; the computer-method characterized in that: as a result of traversing, detecting a flow control element that specifies a plurality of exit control flows (341, 342) that might be taken at runtime depending on a value of a parameter at runtime; in response to said detecting a flow control element, finding a value narrowing point in the control flow graph prior to the flow control element such that the value narrowing point narrows the value of the parameter such that the exit control flow that would be selected by the flow control element is deterministic; wherein attempting to find a value narrowing point comprises at least one of the following: backward traversing the flow control graph until the value narrowing point is found; backward traversing the flow control graph until a definition with a statically known value of the parameter is found; and backward traversing the flow control graph until a backward traversal limit is encountered; identifying, from the plurality of exit control flows, the exit control flow that would be taken given the found value narrowing point; and modifying the control flow such that the control flow graph from the found value narrowing point leads to the identified exit control flow without traversing the flow control element. traversing a control flow graph corresponding to the control flow of the software program; the computer-method characterized in that: as a result of traversing, detecting a flow control element that specifies a plurality of exit control flows (341, 342) that might be taken at runtime depending on a value of a parameter at runtime; in response to said detecting a flow control element, finding a value narrowing point in the control flow graph prior to the flow control element such that the value narrowing point narrows the value of the parameter such that the exit control flow that would be selected by the flow control element is deterministic; wherein attempting to find a value narrowing point comprises at least one of the following: backward traversing the flow control graph until the value narrowing point is found; backward traversing the flow control graph until a definition with a statically known value of the parameter is found; and backward traversing the flow control graph until a backward traversal limit is encountered; identifying, from the plurality of exit control flows, the exit control flow that would be taken given the found value narrowing point; and modifying the control flow such that the control flow graph from the found value narrowing point leads to the identified exit control flow without traversing the flow control element. as a result of traversing, detecting a flow control element that specifies a plurality of exit control flows (341, 342) that might be taken at runtime depending on a value of a parameter at runtime; in response to said detecting a flow control element, finding a value narrowing point in the control flow graph prior to the flow control element such that the value narrowing point narrows the value of the parameter such that the exit control flow that would be selected by the flow control element is deterministic; wherein attempting to find a value narrowing point comprises at least one of the following: backward traversing the flow control graph until the value narrowing point is found; backward traversing the flow control graph until a definition with a statically known value of the parameter is found; and backward traversing the flow control graph until a backward traversal limit is encountered; identifying, from the plurality of exit control flows, the exit control flow that would be taken given the found value narrowing point; and modifying the control flow such that the control flow graph from the found value narrowing point leads to the identified exit control flow without traversing the flow control element. backward traversing the flow control graph until the value narrowing point is found; backward traversing the flow control graph until a definition with a statically known value of the parameter is found; and backward traversing the flow control graph until a backward traversal limit is encountered; identifying, from the plurality of exit control flows, the exit control flow that would be taken given the found value narrowing point; and modifying the control flow such that the control flow graph from the found value narrowing point leads to the identified exit control flow without traversing the flow control element.