With IBM's XL compiler family it is possible to supply two options (-qreport
and -qlist
) to generate reports for each source file that include information on which optimizations were applied, or which parts of the code could not be optimized (and why).
Is it possible to get a similar reporting for GNU's g++ - and if yes, how to do it?
Have a look at the -fdump-tree-[switch]
flags. You can use -fdump-tree-all
to get loads of information.
Also in trunk gcc -fopt-info-[options]
will give you access higher level optimization information e.g. when particular optimizations were applied, missed etc e.g.
-fopt-info-inline-optimized-missed
Prints all successful and missed inlining optimizations (to stderr
in this case). This is obviously pretty new functionality so I'm not sure how well supported it is yet.
In earlier releases they had -ftree-vectorizer-verbose=n
which is now being deprecated in favor of opt-info.
All these options are listed here https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html though it can be a bit tricky to pick out the useful ones.