loop-invariant code motion
Moving work that gives the same answer every time round a loop to before the loop, so it is done once.
Loop-invariant code motion hoists computations whose operands do not change within the loop into the loop's preheader (and may sink stores after it), when doing so is safe.
Examples
In
for (...) a[i] = x * y;,x * yis computed once, before the loop.
See also