Turning Off Backend Passes

So LLVMTargetMachine.cpp adds lots of transformation passes in the
various addPasses* routines. We'd prefer not to run all of these
things (LSR, for example). We've sort of dealt with it for now but
we'd really like to be able to turn some of these things off in a
convenient way.

We could just comment stuff out but we'd like to remain as close to
upstream as possible. Can anyone think of a good way to provide the
needed flexibility here? Maybe a flags that says "just do the bare
minimum to generate code?" Would anyone object to that?

                            -Dave

So LLVMTargetMachine.cpp adds lots of transformation passes in the
various addPasses* routines. We'd prefer not to run all of these
things (LSR, for example). We've sort of dealt with it for now but
we'd really like to be able to turn some of these things off in a
convenient way.

We could just comment stuff out but we'd like to remain as close to
upstream as possible. Can anyone think of a good way to provide the
needed flexibility here? Maybe a flags that says "just do the bare
minimum to generate code?" Would anyone object to that?

If you have a custom compiler, why not have llvm-gcc (or whatever frontend you use) create its own pass manager? That way, it can control the exactly what passes it wants.

Evan

Because addPasses* do a lot of useful stuff. There's already a "Fast"
flag but it's overloaded. What if we replaced it with a bitvector of
flags?

                                -Dave

If you have a custom compiler, why not have llvm-gcc (or whatever
frontend you use) create its own pass manager? That way, it can
control the exactly what passes it wants.

Because addPasses* do a lot of useful stuff. There's already a "Fast"
flag but it's overloaded. What if we replaced it with a bitvector of
flags?

Fast has been replaced with optimization level. I am not opposed to enhancing it but I'd prefer to keep it simple.

addPasses* just add a bunch of passes to PM. It's really not a lot to replicate if want your own custom llc / llvm-gcc.

Evan