[llvm-dev] Running verify between every opt pass?

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 8 11:01:48 PDT 2016


> 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



More information about the llvm-dev mailing list