[cfe-dev] Strange default optimization passes

Eli Friedman eli.friedman at gmail.com
Tue Sep 8 18:49:15 PDT 2009

I just noticed when looking at some code in clang that at -O3, we run
scalarrepl, then run mem2reg almost immediately afterwards.  I don't
think this is intentional, but I'm not exactly sure how we ended up in
the current situation.

For reference, output from -debug-pass=Arguments for a file with a
single function:
Pass Arguments:  -preverify -domtree -verify -simplifycfg -domtree
-domfrontier -scalarrepl -instcombine
Pass Arguments:  -raiseallocs -simplifycfg -domtree -domfrontier
-mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine
-simplifycfg -basiccg -prune-eh -functionattrs -inline -argpromotion
-simplify-libcalls -instcombine -jump-threading -simplifycfg -domtree
-domfrontier -scalarrepl -instcombine -break-crit-edges -condprop
-tailcallelim -simplifycfg -reassociate -domtree -loops -loopsimplify
-domfrontier -lcssa -loop-rotate -licm -lcssa -loop-unswitch
-instcombine -scalar-evolution -lcssa -iv-users -indvars
-loop-deletion -lcssa -loop-unroll -instcombine -memdep -gvn -memdep
-memcpyopt -sccp -instcombine -break-crit-edges -condprop -domtree
-memdep -dse -adce -simplifycfg -strip-dead-prototypes
-print-used-types -deadtypeelim -constmerge -print-module


More information about the cfe-dev mailing list