[LLVMdev] Reproducing output of llvm-gcc using opt tool

Devang Patel dpatel at apple.com
Mon Dec 10 09:24:07 PST 2007


On Dec 7, 2007, at 8:33 PM, Chris Lattner wrote:

> It's a bit complicated, because llvm-gcc runs a couple of local passes
> as it parses and builds the llvm code, then it runs the passes above
> on the whole module afterwards.  I don't know if there is a good way
> to get the prepasses, Devang, do you know?



$ cat a.c

#include <stdio.h>

void print() {
	printf("I'm print\n");
}

int main(int argc, char *argv[]) {
   printf (" me = %s\n", argv[0]);
}
$llvm-gcc-4.2 -O2 -fdebug-pass-arguments a.c
Pass Arguments:  -simplifycfg -domtree -domfrontier -scalarrepl - 
instcombine
Pass Arguments:  -simplifycfg -domtree -domfrontier -scalarrepl - 
instcombine
Pass Arguments:  -raiseallocs -simplifycfg -domtree -domfrontier - 
mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine - 
simplifycfg -basiccg -prune-eh -simplify-libcalls -tailduplicate - 
instcombine -simplifycfg -domtree -domfrontier -scalarrepl - 
instcombine -break-crit-edges -condprop -tailcallelim -simplifycfg - 
reassociate -domtree -loops -loopsimplify -domfrontier -scalar- 
evolution -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine  
-scalar-evolution -lcssa -indvars -scalar-evolution -lcssa -loop- 
unroll -instcombine -domtree -memdep -gvn -sccp -instcombine -break- 
crit-edges -condprop -memdep -dse -mergereturn -postdomtree - 
postdomfrontier -adce -simplifycfg -constmerge -strip-dead-prototypes
Pass Arguments:  -domtree -loops -loopsimplify -scalar-evolution -loop- 
reduce -lowergc -lowerinvoke -unreachableblockelim -codegenprepare - 
livevars -phi-node-elimination -twoaddressinstruction -liveintervals - 
domtree -loops -simple-register-coalescing -domtree -loops -livevars
Pass Arguments:  -domtree -loops -loopsimplify -scalar-evolution -loop- 
reduce -lowergc -lowerinvoke -unreachableblockelim -codegenprepare - 
livevars -phi-node-elimination -twoaddressinstruction -liveintervals - 
domtree -loops -simple-register-coalescing -domtree -loops -livevars
$

Here, each function is processed by "-simplifycfg -domtree - 
domfrontier -scalarrepl -instcombine" local passes before entire  
module is optimized.

-
Devang






More information about the llvm-dev mailing list