Mikael Holmén via llvm-dev
2016-Jul-08 07:38 UTC
[llvm-dev] Running verify between every opt pass?
Hi, Is there any easy way to run the verifier between each pass in opt if I do e.g. opt -O3 foo.ll -o foo.opt.ll ? If I add -verify after -O3 I get one invocation of the verifier first in the FunctionPass manager and then get two (!) runs of the verifier after all other passes are run. Then I saw the flag -verify-each which sounds promising, the help text says - Verify after each transform but if I do -O3 -verify-each it still looks like the verifier is only run once, first in the FunctionPass manager? Is there any way to do this somewhat easily? (And the reason I got interested in this is that we've recently seen a bug in the loop-vectorizer where a verifer invocation would have complained, but without it the resulting code from opt was wrong which later caused the code to do the wrong thing at runtime. And running a single verifier pass after all of the opt passes wouldn't have caught it either because some other pass had already rewritten the code by then so the verifier wouldn't complain anymore.) Thanks, Mikael
Mehdi Amini via llvm-dev
2016-Jul-08 18:01 UTC
[llvm-dev] Running verify between every opt pass?
> On Jul 8, 2016, at 12:38 AM, Mikael Holmén via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > Is there any easy way to run the verifier between each pass in opt if I do e.g. opt -O3 foo.ll -o foo.opt.ll ?I don’t think so.> > If I add -verify after -O3 I get one invocation of the verifier first in the FunctionPass manager and then get two (!) runs of the verifier after all other passes are run. > > Then I saw the flag -verify-each which sounds promising, the help text says > > - Verify after each transform > > but if I do > > -O3 -verify-each > > it still looks like the verifier is only run once, first in the FunctionPass manager?The verify-each flag only works for passes that are specified on the command line, it does not operate on O3.> > Is there any way to do this somewhat easily?As a workaround, you can get the list of passes that matches O3: echo "" | opt -O3 -debug-pass=Arguments And the re-run opt with all theses passes on the command line instead of O3. — Mehdi> > (And the reason I got interested in this is that we've recently seen a bug in the loop-vectorizer where a verifer invocation would have complained, but without it the resulting code from opt was wrong which later caused the code to do the wrong thing at runtime. > > And running a single verifier pass after all of the opt passes wouldn't have caught it either because some other pass had already rewritten the code by then so the verifier wouldn't complain anymore.) > > Thanks, > Mikael > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Madhur Amilkanthwar via llvm-dev
2016-Jul-08 18:16 UTC
[llvm-dev] Running verify between every opt pass?
Mehdi, as you said yes this is a workaround but this is not portable and i think the scenario mentioned here could occur in general. So running verify pass after each pass is useful.. May be we should invoke verify pass after each pass in O3 under an option say --verify-after-each? In other words, opt will invoke verify pass after each pass only if the above option is provided. On Jul 8, 2016 11:31 PM, "Mehdi Amini via llvm-dev" <llvm-dev at lists.llvm.org> wrote:> On Jul 8, 2016, at 12:38 AM, Mikael Holmén via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi, > > Is there any easy way to run the verifier between each pass in opt if Ido e.g. opt -O3 foo.ll -o foo.opt.ll ? I don’t think so.> > If I add -verify after -O3 I get one invocation of the verifier first inthe FunctionPass manager and then get two (!) runs of the verifier after all other passes are run.> > Then I saw the flag -verify-each which sounds promising, the help textsays> > - Verify after each transform > > but if I do > > -O3 -verify-each > > it still looks like the verifier is only run once, first in theFunctionPass manager? The verify-each flag only works for passes that are specified on the command line, it does not operate on O3.> > Is there any way to do this somewhat easily?As a workaround, you can get the list of passes that matches O3: echo "" | opt -O3 -debug-pass=Arguments And the re-run opt with all theses passes on the command line instead of O3. — Mehdi> > (And the reason I got interested in this is that we've recently seen abug in the loop-vectorizer where a verifer invocation would have complained, but without it the resulting code from opt was wrong which later caused the code to do the wrong thing at runtime.> > And running a single verifier pass after all of the opt passes wouldn'thave caught it either because some other pass had already rewritten the code by then so the verifier wouldn't complain anymore.)> > Thanks, > Mikael > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev_______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160708/f77a0be6/attachment.html>
Mehdi Amini via llvm-dev
2016-Jul-08 18:18 UTC
[llvm-dev] Running verify between every opt pass?
> On Jul 8, 2016, at 11:16 AM, Madhur Amilkanthwar <madhur13490 at gmail.com> wrote: > > Mehdi, as you said yes this is a workaround but this is not portable >Not sure what you mean by “not portable”?> and i think the scenario mentioned here could occur in general. So running verify pass after each pass is useful.. May be we should invoke verify pass after each pass in O3 under an option say --verify-after-each? In other words, opt will invoke verify pass after each pass only if the above option is provided. >Patch welcome :) Not sure what’s the best way to implement it though... — Mehdi> On Jul 8, 2016 11:31 PM, "Mehdi Amini via llvm-dev" <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > > On Jul 8, 2016, at 12:38 AM, Mikael Holmén via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > > > > Hi, > > > > Is there any easy way to run the verifier between each pass in opt if I do e.g. opt -O3 foo.ll -o foo.opt.ll ? > > I don’t think so. > > > > > If I add -verify after -O3 I get one invocation of the verifier first in the FunctionPass manager and then get two (!) runs of the verifier after all other passes are run. > > > > Then I saw the flag -verify-each which sounds promising, the help text says > > > > - Verify after each transform > > > > but if I do > > > > -O3 -verify-each > > > > it still looks like the verifier is only run once, first in the FunctionPass manager? > > > The verify-each flag only works for passes that are specified on the command line, it does not operate on O3. > > > > > > Is there any way to do this somewhat easily? > > As a workaround, you can get the list of passes that matches O3: > > echo "" | opt -O3 -debug-pass=Arguments > > And the re-run opt with all theses passes on the command line instead of O3. > > — > Mehdi > > > > > > > (And the reason I got interested in this is that we've recently seen a bug in the loop-vectorizer where a verifer invocation would have complained, but without it the resulting code from opt was wrong which later caused the code to do the wrong thing at runtime. > > > > And running a single verifier pass after all of the opt passes wouldn't have caught it either because some other pass had already rewritten the code by then so the verifier wouldn't complain anymore.) > > > > Thanks, > > Mikael > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160708/5985ce40/attachment.html>
Possibly Parallel Threads
- opt - replicating multiple passes from -O3 -debug-pass=Executions
- load instruction erroneously removed by GVN
- Ok with mismatch between dead-markings in BUNDLE and bundled instructions?
- Some questions about phase ordering in OPT and LLC
- [LLVMdev] opt -verify