This patch fixes a problem encountered by the CellSPU backend where variants
[oota-llvm.git] / utils / findmisopt
index 8ee3250eb2d2e3c27c3b73e71deca15b00dd3991..b7ffbd9947d5a8accf87626a4914a05c3366f2dc 100755 (executable)
@@ -73,6 +73,13 @@ echo "Test Name: $name"
 echo "Unoptimized program: $prog"
 echo "  Optimized program: $optprog"
 
+# Define the list of optimizations to run. This comprises the same set of 
+# optimizations that opt -std-compile-opts and gccld run, in the same order.
+opt_switches=`llvm-as < /dev/null -o - | opt -std-compile-opts -disable-output -debug-pass=Arguments 2>&1 | sed 's/Pass Arguments: //'`
+ld_switches=`llvm-as < /dev/null -o - | llvm-ld - -debug-pass=Arguments 2>&1 | sed 's/Pass Arguments: //'`
+all_switches="$opt_switches $ld_switches"
+echo "Passes : $all_switches"
+
 # Create output directory if it doesn't exist
 if [ -f "$outdir" ] ; then
   echo "$outdir is not a directory"
@@ -92,13 +99,6 @@ gcc "$s" -o "$prog" $ldflags || exit 1
 "$prog" $args > "$out" 2>&1 <$input
 ex1=$?
 
-# Define the list of optimizations to run. This comprises the same set of 
-# optimizations that gccas and gccld run, in the same order.
-all_switches="-verify -lowersetjmp -funcresolve -raiseallocs -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -prune-eh -inline -simplify-libcalls -argpromotion -raise -tailduplicate -simplifycfg -scalarrepl -instcombine -predsimplify -condprop -tailcallelim -simplifycfg -reassociate -licm -loop-unswitch -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -condprop -dse -dce -simplifycfg -deadtypeelim -constmerge -funcresolve -internalize -ipsccp -globalopt -constmerge -deadargelim -inline -prune-eh -globalopt -globaldce -argpromotion -instcombine -predsimplify -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -dse -instcombine -simplifycfg -verify"
-# Here's an alternative list of optimizations comprising just the ones that 
-# gccld uses. To use, just comment out the line above, and uncomment this one
-#all_switches="-funcresolve -internalize -ipsccp -globalopt -constmerge -deadargelim -inline -prune-eh -globalopt -globaldce -argpromotion -instcombine -predsimplify -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -dse -instcombine -simplifycfg -verify"
-
 # Current set of switches is empty
 function tryit {
   switches_to_use="$1"