Specifying a sequence of optimization flags on llvm-gcc

Hello all,

I’m very new to llvm, and I’m trying to compile a C file using llvm-gcc, but I’d like to specify the optimization passes sequence by myself. How can I do this?

Thanks!

Felipe

Hi Felipe,

Hello all,

I'm very new to llvm, and I'm trying to compile a C file using llvm-gcc, but
I'd like to specify the optimization passes sequence by myself. How can I do
this?

I guess this may be what you're looking for:

  http://llvm.org/cmds/opt.html

Hi Felipe,

I'm very new to llvm, and I'm trying to compile a C file using llvm-gcc,
but I'd like to specify the optimization passes sequence by myself. How
can I do this?

try something like this:

llvm-gcc -c -emit-llvm -o - | opt ...list.transforms.here... > result.bc

This results in optimized bitcode in result.bc.

Ciao,

Duncan.

Another question about it: is this transforms list applied in the same order it’s given to the command line? Can I repeat a transformation pass within a list?

Thanks you!

Felipe

try something like this:

llvm-gcc -c -emit-llvm -o - | opt ...list.transforms.here... > result.bc

Another question about it: is this transforms list applied in the same order
it's given to the command line?

hmm.. yes. Use -debug-pass=... on the opt command line to see what is
being executed. 'opt --help-hidden' lists -debug-pass and other hidden
command line options.

Can I repeat a transformation pass within a
list?

Yes!

Great. Thanks everyone!

Hi Felipe,

Another question about it: is this transforms list applied in the same
order it's given to the command line? Can I repeat a transformation pass
within a list?

"opt -O2" gives you almost the same as "llvm-gcc -O2" etc.

Ciao,

Duncan.