取自 GCC 手册:
-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.
根据我的理解,展开循环将摆脱结果代码中的分支指令,我认为它对 CPU 管道更健康。
但为什么它“可能不会让它跑得更快”呢?