Compilers have advanced capabilities for emitting human-readable diagnostics, in order to provide the developer with insight into what optimizations the compiler was able to make.
- C and C++: use the flag -fsave-loopmark to generate a new file with the .lst extension which includes the compiler's optimization report embedded inline with the original source code.
- Fortran: use the flag -h list=a to get similar result as described above.
- Intel, use flag -qopt-report instructs the Intel compilers to emit optimization diagnostic information. A new file will be generated with the .optrpt extension.
- GNU: you can use the flag -O3 -fopt-info where all optimization info is output on to stderr.