/O3 is particularly important during the compilation step. I do not think if it has any effects during the linking step (I may be wrong though), but specifying the flag at all stages of compilation and linking won’t hurt if not help with optimization. Intel website has excellent documentation of all of the ifort Fortran compiler flags including O3. What you probably need to specify at link time is the /Qipo interprocedural optimization flagbetween files. Here is a set of optimization flags that I typically use: /O3 /Qip /Qipo /Qunroll /Qunroll-aggressive. You could likely generate even faster code by specifying hardware-specific optimization flags. Use /Qparallel to enable auto-parallelization of Fortran do concurrent and other parallel features of Fortran (although, auto parallelization is not guaranteed).
With ifort, there’s no point in using xilib unless you are also using -ipo, and if you ARE using -ipo to build a static library, you must link the executable with ifort -ipo or use xilink. -O3 indeed affects compilation only, not library/link.
@sblionel, many thanks for your help.
Just to be sure I’m getting it right, the flag O3 should be incorporated only at the step 3, namely, when compiling and linking. Am I correct?