Optimizing at level 3

Benefits at level 3

  • Better loop scheduling
  • High-order loop analysis and transformations (-qhot=level=0)
  • Inlining of small procedures within a compilation unit by default
  • Eliminating implicit compile-time memory usage limits

Specifying -O3 initiates more intense low-level transformations that remove many of the limitations present at -O2. For instance, the optimizer no longer checks for memory limits, by setting the default to -qmaxmem=-1. Additionally, optimizations encompass larger program regions and attempt more in-depth analysis. Although not all applications contain opportunities for the optimizer to provide a measurable increase in performance, most applications can benefit from this type of analysis.

Potential trade-offs at level 3

With the in-depth analysis of -O3 comes a trade-off in terms of compilation time and memory resources. Also, because -O3 implies -qnostrict, the optimizer can alter certain floating-point semantics in your application to gain execution speed. This typically involves precision trade-offs as follows:
  • Reordering of floating-point computations
  • Reordering or elimination of possible exceptions, such as division by zero or overflow
  • Using alternative calculations that might give slightly less precise results or not handle infinities or NaNs in the same way

You can still gain most of the -O3 benefits while preserving precise floating-point semantics by specifying -qstrict. Compiling with -qstrict is necessary if you require the same absolute precision in floating-point computational accuracy as you get with -O0, -O2, or -qnoopt results. The option -qstrict=ieeefp also ensures adherence to all IEEE semantics for floating-point operations. If your application is sensitive to floating-point exceptions or the order of evaluation for floating-point arithmetic, compiling with -qstrict, -qstrict=exceptions, or -qstrict=order helps to ensure accurate results. You should also consider the impact of the -qstrict=precision suboption group on floating-point computational accuracy. The precision suboption group includes the individual suboptions: subnormals, operationprecision, association, reductionorder, and library (described in the -qstrict option).

Without -qstrict, the difference in computation for any one source-level operation is very small in comparison to Basic optimization. Although a small difference can be compounded if the operation is in a loop structure where the difference becomes additive, most applications are not sensitive to the changes that can occur in floating-point semantics.

For information about the -O level syntax, see -O -qoptimize .



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