The idea is to position the basic blocks of a procedure in such a way that
most executions of the code will fall through branches (forward branches
are typically predicted to not be taken). This minimizes the cost of
branch mispredictions, and keeps commonly executed code together. The latter
will have the effect of making best use of the instruction cache, and
minimizing cache collisions.
Such optimal positioning of basic blocks can be very effective at speeding
up programs, especially when the information about branch frequencies is
obtained dynamically (i.e. as the program is running).
--
MikeVanEmmerik - 01 Dec 2001
CategoryOptimization