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 among 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 Optimization and Programming Guide for details about 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 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.

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.

-qdirectstorage None.

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

-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 as if system calls would not modify errno.

-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.

-qinline None.

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

-qrestrict None.

Specifying this option is equivalent to adding the restrict keyword to the pointer parameters within the specified functions, except that you do not need to modify the source file.

-qshowpdf None.

When used with -qpdf1 and a minimum optimization level of -O2 at compile and link steps, creates a PDF map file that contains additional profiling information for all procedures in your application.

-qsimd

#pragma nosimd

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

-qsmallstack None.

Minimizes stack usage where possible. Disables optimizations that increase 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 that are done by default at the -O3 and higher optimization levels, 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. Allows specification of a target SMT mode to direct optimizations for best performance in that mode.

-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.

-qvisibility #pragma GCC visibility push, #pragma GCC visibility pop

Specifies the visibility attribute for external linkage entities in object files. The external linkage entities have the visibility attribute that is specified by the -qvisibility option if they do not get visibility attributes from pragma directives, explicitly specified attributes, or propagation rules.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us