As already noted, high optimization levels can increase code size. The following sections detail other compiler options that can influence the size of your code.
The -qipa option enables interprocedural analysis (IPA) by the compiler. Interprocedural analysis analyzes the relationships between procedures and the code that references those procedures, so that more optimizations within procedures and across procedure references can take place. Interprocedural analysis can decrease code size and improve performance at the same time. In some cases however, IPA inlining can increase code size. Use with discretion.
Using the -Q compiler option, you can specify that the optimizer consider all Fortran 90 or Fortran 95 procedures, or a particular list of procedures for inlining. Specifying -qipa=inline also inlines procedures and can alter the limits of -Q. Inlining procedures can increase the performance of your application, though if your program references a procedure from many different locations in the source code, inlining that procedure can increase code size dramatically. You can disable procedure inlining entirely using -Q!, or -qipa=inline=noauto. You can also partially disable inlining with -Q-names.
However, do not assume that all inlining increases code size. When your source code references a very small procedure a large number of times, inlining can reduce code size, as inlining eliminates control transfer and data interface code. In addition, inlining code facilitates other optimizations at the point of inlining, by providing information on the values of arguments referencing the procedure. If a procedure is very small and is referenced from a number of places, inlining can also increase code locality and reduce code paging.
The loop analysis and optimization available when you specify -qhot can increase code size. If your application contains many large loops and loop optimization opportunities exist, -qhot code size can increase significantly along with performance. Specifying -qhot=level=0 will perform minimal high-order transformations if code size is an issue. The section on Benefits of High Order Transformation contains more information on using -qhot effectively.
The -qcompact compiler option instructs the compiler to avoid certain optimizing transformations that expand the object code. Compiling with -qcompact, disables many transformations, including:
Specifying -qcompact creates a trade-off between the performance of individual routines in your application, and overall system performance. Suppressing transformations degrades the performance of individual routines, while overall system performance can increase as a more compact program can provide some or all of the following: