[LLVMdev] Optimization application by llvm-gcc, opt
baldrick at free.fr
Tue Dec 13 12:15:22 PST 2011
> Thanks Duncan. Just to make sure I understand correctly, opt has more global information, due to which optimizations can have greater effect than in llvm-gcc, where optimizations are applied on a per-function basis. Is this correct ?
if you look carefully at what "opt -O3" runs (using -debug-pass=Arguments) you
will see that it first runs a small list of passes (the "per function" passes),
and later runs a much more complete list of passes. As each function is output,
llvm-gcc runs these "per-function" passes on it. Once the entire module is
output, llvm-gcc runs the second list of passes on the whole module. Thus it
is not correct to say that optimizations are applied only on a per-function
basis in llvm-gcc. On the other hand opt applies both lists of passes to the
entire module. Your remark "opt has more global information, due to which
optimizations can have greater effect than in llvm-gcc" is correct, but only
applies to the first list of passes, since for the second list of passes
llvm-gcc also has the entire module available when applying them.
More information about the llvm-dev