[llvm-dev] registering passes at the beginning/end of opt passes (new pass manager)

Arthur Eubanks via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 7 10:36:03 PST 2020


You could always specify the full adaptor stack for loop passes, e.g.
"module(function(loop(unswitch<nontrivial>)))".

Another option is to register your passes via the flags mentioned above and
run default<O0>, which should invoke all the registered callbacks.

On Mon, Dec 7, 2020 at 2:47 AM Juneyoung Lee via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Okay, I tried something like this:
>
> Given opt -passes='...', my bash script strips the quotes, puts
> module(mypass) at the begin/end, put quotes again, and runs it. mypass is a
> module-level pass.
>
> ex) Given opt -passes='sroa' , it emits opt
> -passes='module(mypass),sroa,module(mypass)'
>
> The emitted command seems working in this case, but I found that it breaks
> when loop-level passes are there:
>
> ex) Running opt
> -passes='module(mypass),loop(unswitch<nontrivial>),module(mypass)' shows:
> build/bin/opt: invalid use of 'loop' pass as module pipeline
>
>
> Is there a way to correctly add 'mypass' to the begin/end of the passes
> regardless of the level of the pipeline?
>
> Thanks,
> Juneyoung
>
> On Fri, Dec 4, 2020 at 1:28 PM Juneyoung Lee <juneyoung.lee at sf.snu.ac.kr>
> wrote:
>
>> Hello all,
>>
>> Can I register passes at the beginning/end of opt passes (new pass
>> manager)?
>>
>> I found that
>> registerPipelineStartEPCallback/registerOptimizerLastEPCallback work
>> successfully for clang, but they don't fire when opt -passes="" is used.
>>
>> Thanks,
>> Juneyoung
>>
>>
>
> --
>
> Juneyoung Lee
> Software Foundation Lab, Seoul National University
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://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/20201207/f3091dd8/attachment.html>


More information about the llvm-dev mailing list