This section discusses the command-line options -O0, -O1, -O2 (or -O), and -O3. The -O0 option disables optimizations. Each of the other three turns on several compiler capabilities. To specify one of these optimizations, take into consideration the nature and structure of your application as indicated in the more detailed description of the options.
In general terms, -O1, -O2 (or -O), and -O3 optimize as follows:
-O1 : code size and locality
-O2 (or -O): code speed; this is the default option
-O3: enables -O2 with more aggressive optimizations.
-fast: enables -O3 and -ipo to enhance speed across the entire program.
These options behave similarly on IA-32 and ItaniumŪ architectures, with some specifics that are detailed in the sections that follow.