Jump to content

Talk:Loop-invariant code motion

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Daira Emma Hopwood (talk | contribs) at 01:15, 29 January 2007 (discuss why another transformation was deleted). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

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).