[LLVMdev] Safe Passes

Duncan Sands baldrick at free.fr
Tue Jan 3 09:31:22 PST 2012


Hi Marco,

> Which transformation passes are 'safe', meaning it does not worsens the
> effectiveness of a later pass or the generated code?

are you looking for a guarantee, or just "usually makes things better"?
All standard passes usually make things better otherwise they wouldn't
be run!  Consider for example GVN: this is a pass that has a big impact,
usually it is a win; but it also tends to increase register pressure so
it can make things worse (it can make things worse for other reasons too).

  I imagine all
> passes which either removes data or add attributes are included in this
> list,

Ha, if only things were so simple!  Anyone who has implemented any optimization
has discovered that there is always some program somewhere that runs slower
because of it.  For example, marking a function as readonly should be a win,
right?  Yet by doing so you open up additional possibilities for other passes
which might make things worse, for example by moving code around in an
unfortunate way.

  plus some simplification passes:
>
> -adce
> -argpromotion
> -constmerge
> -constprop
> -deadargelim
> -dse
> -functionattrs
> -globaldce
> -globalopt
> -gvn
> -instcombine
> -internalize
> -ipconstprop
> -ipsccp
> -licm
> -prune-eh
> -sccp

Most of these can make things worse.

Ciao, Duncan.

>
> Also, is there any redundant pass in this list (things line sccp/ipsccp)?
> _______________________________________________
> 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