GCC, compare the effect of using -O2 and using all the optimization flags it turns on

前端 未结 2 1587
一个人的身影
一个人的身影 2021-01-22 01:21

From gcc5.4 documentation, it says

-O2 turns on all optimization flags specified by -O. It also turns on the following optimization flags:

-ft

2条回答
  •  無奈伤痛
    2021-01-22 01:25

    The optimisation level affects decisions in other parts of the compiler besides determining which passes get run. These can be during mandatory processes like transforming between internal representations of the code, register allocation etc, so the optimisation level is not exactly equivalent to a set of switches enabling every compiler pass. Look at this thread for some discussion on this topic.

提交回复
热议问题