[llvm-dev] Some questions about phase ordering in OPT and LLC

Ricardo Nobre via llvm-dev llvm-dev at lists.llvm.org
Mon May 9 10:43:30 PDT 2016


Hi,

I'm a PhD student doing phase ordering as part of my PhD topic and I 
would like to ask some questions about LLVM.

Executing the following command to see what passes does OPT execute when 
targeting a SPARC V8 processor:

/opt/clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-15.10/bin/llvm-as < 
/dev/null | /opt/clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-15.10/bin/opt 
-O3 -march=sparc -mcpu=v8 -disable-output -debug-pass=Arguments

I get the following output:
Pass Arguments:  -tti -no-aa -tbaa -scoped-noalias 
-assumption-cache-tracker -targetlibinfo -basicaa -verify -simplifycfg 
-domtree -sroa -early-cse -lower-expect
Pass Arguments:  -targetlibinfo -tti -no-aa -tbaa -scoped-noalias 
-assumption-cache-tracker -basicaa -ipsccp -globalopt -deadargelim 
-domtree -instcombine -simplifycfg -basiccg -prune-eh -inline-cost 
-inline -functionattrs -argpromotion -domtree -sroa -early-cse 
-lazy-value-info -jump-threading -correlated-propagation -simplifycfg 
-domtree -instcombine -tailcallelim -simplifycfg -reassociate -domtree 
-loops -loop-simplify -lcssa -loop-rotate -licm -loop-unswitch 
-instcombine -scalar-evolution -loop-simplify -lcssa -indvars 
-loop-idiom -loop-deletion -loop-unroll -mldst-motion -domtree -memdep 
-gvn -memdep -memcpyopt -sccp -domtree -bdce -instcombine 
-lazy-value-info -jump-threading -correlated-propagation -domtree 
-memdep -dse -loops -loop-simplify -lcssa -licm -adce -simplifycfg 
-domtree -instcombine -barrier -float2int -domtree -loops -loop-simplify 
-lcssa -loop-rotate -branch-prob -block-freq -scalar-evolution 
-loop-accesses -loop-vectorize -instcombine -scalar-evolution 
-slp-vectorizer -simplifycfg -domtree -instcombine -loops -loop-simplify 
-lcssa -scalar-evolution -loop-unroll -instcombine -loop-simplify -lcssa 
-licm -scalar-evolution -alignment-from-assumptions 
-strip-dead-prototypes -elim-avail-extern -globaldce -constmerge -verify

Why are there two "Pass Arguments"?
What does it mean?

What passes should I pass the 'opt' tool (the LLVM Optimizer) so that it 
is equivalent to the use of -O3 with 'opt'?
The ones of the first "Pass Arguments", or the second?

I'm testing different phase orders, and one of the exploration schemes I 
want to try is to start with the equivalent of -O3 and iteratively apply 
small changes (e.g. swap passes in the compiler pass sequence equivalent 
to -O3), and compile and test with those different sequences.

Additionally, I'm a bit confused about what passes does 'llc' (the LLVM 
static compiler) apply by default, when passing to it a LLVM IR 
previously optimized using the 'opt' tool.

'llc --help' says that the default is -O2:
"Optimization level. [-O0, -O1, -O2, or -O3] (default = '-O2')"

But is this -O2 the same as the -O2 from the 'opt' tool?

Does it mean that if I generate an optimized LLVM IR with 'opt' (with 
-O2) and pass it to 'llc', it will by default apply all passes in -O2 a 
second time?
Or do 'opt -O2' and 'llc -O2' represent different passes?

Thanks in advance,
Ricardo


More information about the llvm-dev mailing list