GCC documentation is not particularly verbose about it. What it says is:
-fexpensive-optimizations:
Perform a number of minor optimizations that are relatively expensive.
Which kind of optimizations are these? Any example?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not enough of a compiler gee^H^H^H expert to be able to make much of this, but maybe someone can build on it…
The relevant bits of gcc can be obtained easily enough (if you don’t try and check out the whole thing) with:
(at least that’s the subset which seemed relevant to C/C++ which I found stuff in; add other directories if you’re interested in other languages gcc supports)
And then
yields a screen’s worth (35 lines) of hits on a small number of files. I’ll leave it to someone else to post a more detailed analysis (if anyone actually cares enough).
A couple of them caught my eye. I’ll mention that (at time of writing):
The sole mention of
flag_expensive_optimizationsincp/(C++support) is in a section of code commented
/* Handle ordinary C++and seems to influence the setting of adestructors. */
LOOKUP_NONVIRTUALflag, with associated comment/* Optimize forspace over speed here. */
There are a few hits within the processor-specific config/ directory (sparc, alpha, sh, i386) . The only i386 one applies for
TARGET_AVXwhen not optimizing for size and is commented/* When not optimize for size, enable vzeroupper optimization for TARGET_AVX with -fexpensive-optimizations and split 32-byte AVX unaligned load/store. */A glance at a few other hits persuaded me I should just be content to leave my knowledge of this feature at the level of the gcc documentation.