[LLVMdev] opt -O2 optimization passes

Duncan Sands baldrick at free.fr
Tue Nov 15 12:51:13 PST 2011


Hi Seb,

> I would like to know which optimization passes are performed at -O2 by opt. So I
> used following command:
>
> llvm-as < /dev/null | opt -O2 -std-compile-opts -disable-output
> -debug-pass=Arguments

first off, if you pass -O2 there is no need for -std-compile-opts and vice
versa.
>
> I've got following output for LLVM opt 2.9:
>
> Pass Arguments:  -no-aa -tbaa -basicaa -simplifycfg -domtree -scalarrepl -early-cse
> Pass Arguments:  -targetlibinfo -no-aa -tbaa -basicaa -preverify -domtree
...

>
> Why is there two lines stating with 'Pass Argument:' ?

This is coming from -O2.  When a front-end outputs a function, it immediately
runs the per-function passes in the first line on it.  This tends to shrink
functions a lot, reducing memory usage.  When all of the functions have been
output all of the other passes are run.

>
> To reproduce opt-O2 behavior should I copy options from the two lines or only
> second one ?

Both of them.  To be most accurate, you can do the following:

   opt bitcode.bc pass-list-from-first-line | opt pass-list-from-second line

Ciao, Duncan.

> Thanks for your answers
> Best Regards
> Seb
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list