I'm wondering why for example, "Interprocedural Optimizations" aren't enabled by default since they include important things like "dead call deletion" / "inlining" / whole program analysis. Why so?
On the other hand im wondering what compiler settings I should use, to get maximum out of it. // for windows
Should I set O3 / Interprocedural Optimizations / Loop Unrolling ?
Thanks a lot!
If you are using Visual studio for your application, then ipo is enabled by default.
Any optimization is dependent on the nature of the application. Turning on ipo for the entire application, can lead to increase in the binary and in some cases degrade the performance.
Regarding the ideal optimization, O3 is the highest level of optimization and it does loop unrolling as well. But again, it depends on your application. You can refer the below article to choose the optimization based on nature of your application.
IPO can be turned off for link if there are no object files built with IPO. Then (on linux) it's also possible to use the generic gnu object library tools, or (on Windows) it's possible to link with only Microsoft link.
Single file IP can be accomplished without generating IPO objects. It's normally on by default for command line even without IPO set (in VS GUI, you can check the properties to see if it appears to be set).
A limited amount of inner loop unrolling is set by default. In my experience, only for AVX (or some non-vectorizable cases) is it useful to raise the level to /Qunroll:4.