Loop-invariant code motion: Difference between revisions

Content deleted Content added
top: rm unclear subsentence: precisely what doesn't change: source text?, statement semantices as mapping from memory states to memory states (insufficient for code motion)?, computed value of an expression (undefined for arbitrary statements)?
Example: same problem as before
Line 13:
</source>
 
The calculation <code>x = y + z</code> and <code>x * x</code> can be moved outside the loop since within they are [[loop-invariant invariantcode]]&mdash; they do not change over the iterations of the loop&mdash;, so the optimized code will be something like this:
 
<source lang="C">