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 ?
- 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 ?
- 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?
- 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> ... ?
> How should I proceed to develop it and commit changes to LLVM trunk ?
> Thanks for your advices and recommandations.
> Best Regards
> Seb
-
Devang
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Hello,
I have few questions :
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 ?
- Why (and when) would you us this ?
- 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 ?
- 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?
- 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> ... ?
> - 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
> <other_pass>.'
>
I would opt for disabling dependent passes as well, and providing a
warning that they have been disabled implicitly (possibly giving the
disabled pass that caused this effect).
I think such behavior would make sense if you were disabling passes
because they contain bugs.
Another option would be to differentiate between a strong (disabling
pass + dependents) and weak (disabling pass if no dependents) disable
parameter.
- Roel
Just for the record it seems this is a bug in your frontend, not in
the LLVM backend. The memcpy intrinsic, like the standard memcpy
function, requires that the regions be non-overlapping:
http://llvm.org/docs/LangRef.html#int_memcpy By violating this
contract it's possible you'll encounter all sorts of issues in other
passes too.
- David
Do you really want to assign result[0] to everything?
I wonder how much work it is to each the loop-idiom pass to handle this
and the case of reverse indices correctly, if result is char *. E.g.
create either memset or memmove...
Joerg
On Fri, Dec 09, 2011 at 10:03:37AM +0100, Seb wrote:Do you really want to assign result[0] to everything?
> I think my explanation is not clear, my front-end did NOTt generate
> 'llvm.memcpy' it generate LL code that after use of LLVM 'opt' get
> transformed by 'loop-idom' pass into an 'llvm.memcpy' for an overlapping
> loop:
>
> static void
> t0(int n)
> {
> int i;
> for (i=0; i<n; i++)
> result[i+1] = result[i];
> }
I wonder how much work it is to each the loop-idiom pass to handle this
and the case of reverse indices correctly, if result is char *. E.g.
create either memset or memmove...
Joerg
Yes, a peer of mine recently wanted such an option to disable individual
passes in order to 1) narrow in on a bug in one of them that affected
stack back tracing, and 2) provide a workaround for the bug. He didn't
pursue modifying code to remove the passes one at a time and thus the
bug remains hidden.
Tom.
> On 12/9/2011 8:23 AM, Seb wrote:
>> This thread is not to discuss how relevant this example is. I just would
>> like to know:
>> a) If people think that adding an option to disable a specific pass is
>> useful.
>
> Yes, a peer of mine recently wanted such an option to disable individual
> passes in order to 1) narrow in on a bug in one of them that affected
> stack back tracing, and 2) provide a workaround for the bug. He didn't
> pursue modifying code to remove the passes one at a time and thus the
> bug remains hidden.
you don't have to modify code to reduce the list of passes. Get clang (or
whatever) to produce unoptimized bitcode. Check that running
opt -std-compile-opts
(or opt -O3) or whatever reproduces the problem. Adding -debug-pass=Arguments
will show you the list of passes used. You can then run opt with this explicit
list of passes (rather than -std-compile-opts), and remove passes until you find
the problematic one. Bugpoint can do this for you automatically.
Ciao, Duncan.