Methods and apparatus are disclosed for improved loop unrolling by a
compiler. A large class of loops exists for which effective loop
unrolling has not previously been performed because they are too large to
be completely unrolled, but which do not have a single hot trace that
covers an entire loop iteration. The present invention recognizes such
loops that have partial hot traces identified using profile data. A set
of instructions which constitute a proper superset of the hot trace and a
proper subset of the entire loop, and which forms a complete loop
iteration is identified. This set of instructions can then be unrolled
without unrolling the entire loop.