Why some registered passes are not available through opt?

Dear LLVM,

I'm trying to understand why opt tool does not know some of the
registered passes, for example, -targetpassconfig, -gc-lowering,
-unreachableblockelim, -unreachableblockelim, -stack-protector,
-machinemoduleinfo. This prevents me from using bugpoint to reduce the
crash in backend. As I understand, they should be registered and
available through the command line in the same way as all other
passes, shouldn't they?

Thanks,
- Dima.

Hi Dima,

I'm trying to understand why opt tool does not know some of the
registered passes, for example, -targetpassconfig, -gc-lowering,
-unreachableblockelim, -unreachableblockelim, -stack-protector,
-machinemoduleinfo. This prevents me from using bugpoint to reduce the
crash in backend. As I understand, they should be registered and
available through the command line in the same way as all other
passes, shouldn't they?

these are codegen passes not IR passes, and thus are available from llc
not opt.

Ciao, Duncan.

Hi Duncan,

Is it correct that opt does not understand codegen passes, but llc
understands both analysis/transformation and codegen passes? I would
like to modify bugpoint to work on this end.

Thanks,
- D.

Hi Dmitry,

Is it correct that opt does not understand codegen passes, but llc
understands both analysis/transformation and codegen passes?

no.

Ciao, Duncan.

  I would

Sorry, then I don't understand. If I invoke backend with
target->addPassesToEmitFile, it adds both opt and llc passes. Thus,
PassManager contains both opt and llc passes after that. In case of
crash, bugpoint reloads all passes from the failing pass manager to
the separate instance of opt. If opt and llc both do not support such
mixing, then I'm guessing I need to replace "opt" with some customized
pass loader in bugpoint.

- D.

Hi Dmitry,

Sorry, then I don't understand. If I invoke backend with
target->addPassesToEmitFile, it adds both opt and llc passes.

it would be more correct to say that llc contains IR level passes and codegen
level passes (the IR level passes do some cleaning and preparation of the IR
before the IR is lowered codegen form). The IR level passes used by llc and
the IR level passes used by opt are not the same.

Unfortunately the set of passes used by llc cannot be adjusted, unlike with
opt where you can specify what you want in the order you want. There is some
ongoing work to improve this, but for the moment you can't use bugpoint to
narrow down codegen problems to a particular codegen pass like you can with
opt's IR level passes.

Ciao, Duncan.

  Thus,