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

Juneyoung Lee via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 7 16:32:50 PST 2020


Is there a rewriter tool that converts input passes into a string with full
adaptor stacks?

It seems manually updating existing tests' passes to have full adaptor
stack is a tricky job; it would be great if there is an automatic way of
doing that.

Thanks,
Juneyoung


On Tue, Dec 8, 2020 at 3:36 AM Arthur Eubanks <aeubanks at google.com> wrote:

> 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
>>
>

-- 

Juneyoung Lee
Software Foundation Lab, Seoul National University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201208/7677b340/attachment.html>


More information about the llvm-dev mailing list