2

It seems the Unroll Loops optimization settings under the Apple LLVM 8.0 - Code Generation section is turned off by default in the latest XCode, 8.2.1, even for the Release configuration. Any good reason for that? I thought loop unrolling was one of the most basic optimizations.

Danra
  • 9,546
  • 5
  • 59
  • 117

1 Answers1

1

It seems it is disabled to avoid increasing the size of the generated code.

Tuning for Performance and Responsiveness

Table 6-1 Compiler optimization options

Faster

The compiler performs nearly all supported optimizations that do not require a space-time tradeoff. The compiler does not perform loop unrolling or function inlining with this option. This option increases both compilation time and the performance of generated code.

Fastest

The compiler performs all optimizations in an attempt to improve the speed of the generated code. This option can increase the size of generated code as the compiler performs aggressive inlining of functions. This option is generally not recommended.

Community
  • 1
  • 1
lcs
  • 4,227
  • 17
  • 36
  • 2
    Makes sense. Although, I'm actually not entirely sure clang run by XCode doesn't actually *perform* the unrolling, even when the "Unroll Loops" is off, because "Faster" (`-O2`), according to actual clang flags, does include loop unrolling, see http://stackoverflow.com/questions/15548023/clang-optimization-levels/15548189#15548189 – Danra Jan 25 '17 at 15:27