2 Answers
2

Visual C++ does not have an explicit option for loop unrolling. However, if you turn optimisations on, then the optimiser loop unrolls based on heuristic. Loop unrolling is a trade-off - it may or may not result in improved performance.

-funroll-loops
Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop. -funroll-loops implies -frerun-cse-after-loop. This option makes code larger, and may or may not make it run faster.

There is another (similar) option:

-funroll-all-loops
Unroll all loops, even if their number of iterations is uncertain when the loop is entered. This usually makes programs run more slowly. -funroll-all-loops implies the same options as -funroll-loops,