Getting the most from -qipa

It is not necessary to compile everything with -qipa, but try to apply it to as much of your program as possible. Here are some suggestions:
  • Specify the -qipa option on both the compile and the link steps of the entire application. Although you can also use -qipa with libraries, shared objects, and executable files, be sure to use -qipa to compile the main and exported functions.
  • When compiling and linking separately, use -qipa=noobject on the compile step for faster compilation.
  • When specifying optimization options in a makefile, use the compiler driver (xlC) to link with all the compiler options on the link step included.
  • As IPA can generate significantly larger object files than traditional compilations, ensure that there is enough space in the /tmp directory (at least 200 MB). You can use the TMPDIR environment variable to specify a directory with sufficient free space.
  • Try varying the level suboption if link time is too long. Compiling with -qipa=level=0 can still be very beneficial for little additional link time.
  • Use -qipa=list=long to generate a report of functions that were previously inlined. If too few functions are inlined, consider using the -finline-functions option.
  • To generate data reorganization information in the listing file, specify the optimization level -qipa=level=2 or -O5 together with -qreport. During the IPA link pass, the data reorganization messages for program variable data will be produced to the data reorganization section of the listing file with the label DATA REORGANIZATION SECTION. Reorganizations include array splitting, array transposing, memory allocation merging, array interleaving, and array coalescing.
Note: While IPA's interprocedural optimizations can significantly improve performance of a program, they can also cause incorrect but previously functioning programs to fail. Here are examples of programming practices that can work by accident without aggressive optimization but are exposed with IPA:
  • Relying on the allocation order or location of automatic variables, such as taking the address of an automatic variable and then later comparing it with the address of another local variable to determine the growth direction of a stack. The C language does not guarantee where an automatic variable is allocated, or its position relative to other automatic variables. Do not compile such a function with IPA.
  • Accessing a pointer that is either invalid or beyond an array's bounds. Because IPA can reorganize global data structures, a wayward pointer that might have previously modified unused memory might now conflict with user-allocated storage.
  • Dereferencing a pointer that has been cast to an incompatible type.



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