Optimization and tuning

The options in this category allow you to control the optimization and tuning process, which can improve the performance of your application at run time.

Remember that not all options benefit all applications. Trade-offs sometimes occur between an increase in compile time, a reduction in debugging capability, and the improvements that optimization can provide.

You can also control some of these options, such as Optimize, -qcompact, or -qstrict, with an option_override pragma.

In addition to the option descriptions in this section, consult the XL C/C++ Optimization and Programming Guide for a details on the optimization and tuning process as well as writing optimization-friendly source code.
Table 1. Optimization and tuning options
Option name Equivalent pragma name Description
-qaggrcopy None.

Enables destructive copy operations for structures and unions.

-qalias None.

Indicates whether a program contains certain categories of aliasing or does not conform to C/C++ standard aliasing rules. The compiler limits the scope of some optimizations when there is a possibility that different names are aliases for the same storage location.

.
-qarch None.

Specifies the processor architecture for which the code (instructions) should be generated.

-qcache None.

When specified with -O4, -O5, or -qipa, specifies the cache configuration for a specific execution machine.

-qcompact #pragma options compact

Avoids optimizations that increase code size.

-qdataimported, -qdatalocal, -qtocdata None.

Marks data as local or imported in 64-bit compilations.

-qdirectstorage None.

Informs the compiler that a given compilation unit may reference write-through-enabled or cache-inhibited storage.

-qsimd None.

Controls whether the compiler can automatically take advantage of vector instructions for processors that support them.

-qfdpr None.

Provides object files with information that the IBM® Feedback Directed Program Restructuring (FDPR) performance-tuning utility needs to optimize the resulting executable file.

-qhot #pragma nosimd, #pragma novector

Performs high-order loop analysis and transformations (HOT) during optimization.

-qignerrno #pragma options ignerrno

Allows the compiler to perform optimizations that assume errno is not modified by system calls.

-qipa None.

Enables or customizes a class of optimizations known as interprocedural analysis (IPA).

-qisolated_call #pragma options isolated_call, #pragma isolated_call

Specifies functions in the source file that have no side effects other than those implied by their parameters.

-qlargepage None.

Takes advantage of large pages provided on POWER4™ and higher systems, for applications designed to execute in a large page memory environment.

-qlibansi #pragma options libansi

Assumes that all functions with the name of an ANSI C library function are in fact the system functions.

-qlibmpi None.

Asserts that all functions with Message Passing Interface (MPI) names are in fact MPI functions and not a user function with different semantics.

-qmaxmem #pragma options maxmem

Limits the amount of memory that the compiler allocates while performing specific, memory-intensive optimizations to the specified number of kilobytes.

-qminimaltoc None.

Controls the generation of the table of contents (TOC), which the compiler creates for an executable file.

-O, -qoptimize #pragma options optimize

Specifies whether to optimize code during compilation and, if so, at which level.

-p, -pg, -qprofile None.

Prepares the object files produced by the compiler for profiling.

-qpdf1, -qpdf2 None.

Tunes optimizations through profile-directed feedback (PDF), where results from sample program execution are used to improve optimization near conditional branches and in frequently executed code sections.

-qprefetch None.

Inserts prefetch instructions automatically where there are opportunities to improve code performance.

-qprocimported, -qproclocal, -qprocunknown #pragma options procimported, #pragma options proclocal, #pragma options procunkown

Marks functions as local, imported, or unknown in 64-bit compilations.

-qinline None.

Attempts to inline functions instead of generating calls to those functions, for improved performance.

-qshowpdf None.

When used with -qpdf1 and a minimum optimization level of -O2 at compile and link steps, inserts additional profiling information into the compiled application to collect call and block counts for all procedures in the application.

-qsmallstack None.

Reduces the size of the stack frame.

-qsmp None.

Enables parallelization of program code.

-qspeculateabsolutes None.

Works with the -qtocmerge -bl:file for non-IPA links and with the -bl:file for IPA links to disable speculation at absolute addresses.

-qstrict #pragma options strict

Ensures that optimizations done by default at optimization levels -O3 and higher, and, optionally at -O2, do not alter the semantics of a program.

-qstrict_induction None.

Prevents the compiler from performing induction (loop counter) variable optimizations. These optimizations may be unsafe (may alter the semantics of your program) when there are integer overflow operations involving the induction variables.

-qtocmerge None.

Enables TOC merging to reduce TOC pointer loads and improves the scheduling of external loads.

-qtune #pragma options tune

Tunes instruction selection, scheduling, and other architecture-dependent performance enhancements to run best on a specific hardware architecture.

-qunroll #pragma options unroll, #pragma unroll

Controls loop unrolling, for improved performance.

-qunwind None.

Specifies whether the call stack can be unwound by code looking through the saved registers on the stack.