Other optimization options

Options are available to control particular aspects of optimization. They are often enabled as a group or given default values when you enable a more general optimization option or level.

For more information about these options, see the heading for each option in the XL C/C++ Compiler Reference.

Table 1. Selected compiler options for optimizing performance
Option Description
-qignerrno Allows the compiler to assume that errno is not modified by library function calls, so that such calls can be optimized. Also allows optimization of square root operations, by generating inline code rather than calling a library function.
-qsmallstack Instructs the compiler to compact stack storage. Doing so might increase heap usage, which might increase execution time. However, it might be necessary for the program to run or to be optimally multithreaded.
-finline-functions (-qinline) Controls inlining.
-funroll-loops (-qunroll), -funroll-all-loops (-qunroll=yes) Independently controls loop unrolling. -funroll-all-loops is implicitly activated under -O3.
C++ only -fno-exceptions (-qnoeh) Informs the compiler that no C++ exceptions will be thrown and that cleanup code can be omitted. If your program does not throw any C++ exceptions, use this option to compact your program by removing exception-handling code.
-qnounwind Informs the compiler that the stack will not be unwound while any routine in this compilation is active. This option can improve optimization of nonvolatile register saves and restores. In C++, the -qnounwind option implies the -fno-exceptions (-qnoeh) option. It should not be used if the program uses setjmp/longjmp or any other form of exception handling.
-qstrict Disables all transformations that change program semantics. In general, compiling a correct program with -qstrict and any levels of optimization produces the same results as without optimization.
-qnostrict Allows the compiler to reorder floating-point calculations and potentially excepting instructions. A potentially excepting instruction is one that might raise an interrupt due to erroneous execution (for example, floating-point overflow, a memory access violation). -qnostrict is used by default for the -O3 and higher optimization levels.
-qprefetch Inserts prefetch instructions in compiled code to improve code performance. In situations where you are working with applications that generate a high cache-miss rate, you can use its suboption assistthread to generate prefetching assist threads (for example, -qprefetch=assistthread). -qnoprefetch is the default option.



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