[LLVMdev] Adding option to LLVM opt to disable a specific pass from command line

Seb babslachem at gmail.com
Thu Dec 8 01:20:08 PST 2011

Hello Devang,

answers are interleaved

2011/12/7 Devang Patel <dpatel at apple.com>

> Hello,
> On Dec 7, 2011, at 2:07 AM, Seb wrote:
> > Hi all,
> >
> > I would like to add an option for LLVM 'opt' to disable a specific
> optimization pass from command line.
> >
> > The idea is to have something like:
> >
> > opt -O2 -disable-pass=[passname,...]
> >
> > Do you think it could be useful ?
> I have few questions :
> - Why (and when) would you us this ?

I woudl use this to selectively disable passes in opt that are either
redundant with passes performed by the fron-end I'm working on our exhibit
a BUG in opt. For instance, I figured out that loop-idiom pass has a BUG in
LLVM 2.9, a llvm.memcpy is generated for an overlapping memory region and
then x86 backend reorder loads/store thus generating a BUG.

So my use would be to disable all loop-idiom invocations.

> - Some of the passes are executed multiple times, how would you select
> which invocation to disable ? Or would you disable all invocation of such
> passes ?

By default I guess I would like to disable all invocation of such passes.
We could also imagine to have an option -disable-pass=[pass_name:inv_num,
...] to deal with multiple invocation.

- Some passes are required by another passes. In such cases PassManager
> will insist on running them, which may conflict with the user request from
> command line. Who wins?

How to I know that a pass  is required by another ?
Let's say give priority to pass manager and issue a warning like like
'option -disable-pass=<pass_name> ignored because required by pass

- Why not update the list passes run as part of -O2 (use
> --debug-pass=Arguments to get it) to remove selected passes and run opt <my
> list of passes> ... ?
 I also thought about this but it can lead to long command lines and source
of errors.

> > How should I proceed to develop it and commit changes to LLVM trunk ?
> > Thanks for your advices and recommandations.
> > Best Regards
> > Seb
> -
> Devang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111208/8afa6dbc/attachment.html>

More information about the llvm-dev mailing list