Can loops like this one be algorithmically transformed into multiplication Are there known techniques for converting a loop like the following to an if and a multiplication?

while (x &lt; 0) {
    x += 60;
}


It seems clear that this could be replaced with something like the following

if (x &lt; 0) {
    x += f(x, 60);
}


where f contains no loops, presumably using multiplication. This would have the benefit of being faster for sufficiently large negative numbers.

Is there a well understood algorithm for finding f for an arbitrary loop of this form?
The name for this optimization seems to be induction variable elimination, there are some nice slides explaining the idea here.