Compiler optimizations

Don nospam at
Fri Dec 19 01:03:06 PST 2008

dsimcha wrote:
> Does anyone know of a decent guide that has information on what types of
> optimizations compilers typically perform and what they aren't capable of
> performing automatically?  I figure it would be useful to know something like
> this because, when micro-optimizing performance-critical code, it's silly to
> do a low-level optimization that makes the code less readable if the
> compiler's already probably doing it.  On the other hand, it would be nice to
> know exactly what optimizations (besides the obvious stuff like high-level
> design and algorithm optimizations) the compiler can't possibly be
> sufficiently smart to do, so I can spend time looking for opportunities to do
> those.

As always -- Agner Fog. Chapter 1 of his optimisation 
manual lists the optimisations performed for Microsoft, Borland, Intel, 
GCC, DMC, Watcom, and Codeplay C++ compilers. DMD is basically the same 
as DMC, except that it's better at constant propagation.

More information about the Digitalmars-d mailing list