Talk:Loop-invariant code motion

This is an old revision of this page, as edited by Daira Emma Hopwood (talk | contribs) at 01:16, 29 January 2007 (forgot to sign). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 18 years ago by DavidHopwood

The page originally had the following:

This can then be further optimized, leading to less overall executed code for larger values of maxval and/or smaller values of calcval.

int calcval = (4+array[k])*pi+5;
j = j + integer_part((maximum - 1 - j) / calcval) * calcval;

However, that transformation is not "loop-invariant code motion". In any case it is not obviously correct when maximum is near overflow (well, OK, maybe it's undefined behaviour then, but suppose that maximum was unsigned). --DavidHopwood 01:16, 29 January 2007 (UTC)Reply