Loop-invariant code motion: Difference between revisions

Content deleted Content added
MathsPoetry (talk | contribs)
MathsPoetry (talk | contribs)
Line 13:
</source>
 
The calculations <code>x = y + z</code> and <code>x * x</code> can be moved outside the loop since within they are [[loop invariant]]&mdash; they do not change over the iterations of the loop&mdash; so ourthe optimized code will be something like this:
 
<source lang="C">