First debug your program, then recompile it with your desired optimization
options, and test the optimized program before placing the program into production.
If the optimized code does not produce the expected results, you can attempt
to isolate the specific optimization problems in a debugging session.
The following list presents options that provide specialized information,
which can be helpful during the development of optimized code:
- -qsmp=noopt
- If you are debugging SMP code, -qsmp=noopt ensures that the compiler
performs only the minimum transformations necessary to parallelize your code
and preserves maximum debug capability.
- -qkeepparm
- Ensures that procedure parameters are stored on the stack even during
optimization. This can negatively impact execution performance. The -qkeepparm option
then provides access to the values of incoming parameters to tools, such as
debuggers, simply by preserving those values on the stack.
- -qlist
- Instructs the compiler to emit an object listing. The object listing includes
hex and pseudo-assembly representations of the generated instructions, traceback
tables, and text constants.
- -qreport
- Instructs the compiler to produce a report of the loop transformations
it performed and how the program was parallelized. For -qreport to
generate a listing, the options -qhot or -qsmp should
also be specified.
- -qinitauto
- Instructs the compiler to emit code that initializes all automatic variables
to a given value.
- -qextchk
- Generates additional symbolic information to allow the linker to do cross-file
type checking of external variables and functions. This option requires the
linker -btypchk option to be active.
- -qipa=list
- Instructs the compiler to emit an object listing that provides information
for IPA optimization.
You can also use the snapshot pragma to ensure
to that certain variables are visible to the debugger at points in your application.