5.7.7.48 Unroll-loops/unroll-all-loops Options

The -funroll-loops and -funroll-all-loops options control speed-orientated optimizations that attempt to remove branching delays in loops. Unrolled loops typically increase the execution speed of the generated code, at the expense of larger code size.

The -funroll-loops option unrolls loops where the number of iterations can be determined at compile time or when code enters the loop. This option is enabled with -fprofile-use. The -funroll-all-loops option is more aggressive, unrolling all loops, even when the number of iterations is unknown. It is typically less effective at improving execution speed than the -funroll-loops option.

Both options imply -frerun-cse-after-loop, -fweb and -frename-registers.

The -fno-unroll-loops and -fno-unroll-all-loops forms of these options do not unroll any loops and are the default actions if no options are specified.