Summary of Compiler Options for Optimization

The following table describes the compiler options that have the most effect on performance. You can experiment with different combinations of compiler options to see which options are most suitable for your application.

Table 17. Compiler options for optimization

Option Overview
-O0 or -qnoopt The compiler performs very limited optimization. This is the default optimization level. Before you start optimizing your application, ensure that it compiles and executes successfully at optimization level 0.
-qarch The compiler generates instructions for the specified processor architecture. This option allows the compiler to take advantage of processor instructions that exist on the specified architecture but do not exist on other architectures.
-qtune The compiler optimizes the application for the specified processor architecture. The application will run on all of the processors specified by the -qarch option, but its performance will be tuned for the processors specified by the -qtune option.
-O2 The compiler performs basic optimization. This option provides a balance between compilation speed and run-time performance.
-O3 The compiler performs aggressive optimization, including optimizations that are memory-intensive, compile-time-intensive, or both.
-qhot The compiler performs additional loop optimization, automatic vectorization, and optionally performs array padding. This option is most useful for scientific applications that contain numerical processing. If you want better performance than -O3 with less compile time than -O4, try -O3 -qhot.
-qcache The compiler assumes that the processor will have the specified cache configuration. This option can improve performance if all of the processors that execute the application have the same non-default cache configuration.
-qipa The compiler performs interprocedural analysis to optimize the entire application as a unit. This option is most useful for applications that contain a large number of frequently used routines. In many cases, this option significantly increases compilation time.
-O4 This is equivalent to: -O3 -qipa -qhot -qarch=auto -qtune=auto -qcache=auto
-O5 This is equivalent to: -O4 -qipa=level=2
-qpdf1
-qpdf2
The compiler uses profile-directed feedback to optimize the application based on an analysis of how often your application executes different sections of code.
IBM Copyright 2003