Strange default optimization passes

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

-Eli

It may not be, but its been that way for a long time. FWIW, we share
the optimization pass list with llvm-gcc and opt. At the time I
created StandardPasses.h, I did some small massaging to opt's pass
list if I recall correctly, but if you run your example with llvm-gcc
you should see the same thing (the only difference I see between the
lists is that we run prune-eh and llvm-gcc doesn't, this is a bug on
our part).

If you want to dig further it probably makes sense to look at the svn
history for llvm-backend.cpp in llvm-gcc.

- Daniel

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.

Fixed in r82291, thanks Eli!

-Chris