<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">`opt < %s -passed='asan' -asan-module -S`<br></blockquote><div>asan-module is another ModulePass, not a commandline option.  You can't mix that like this.</div><div><br></div><div>Cheers,</div><div>Philip</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
doesn't  produce the same IR as<br>
<br>
`opt < %s -asan -asan-module -S`<br>
<br>
More specifically, the only thing missing seems to be the<br>
`asan.module_ctor` that should get added to the global ctors list.<br>
What I'm not sure of is if I'm missing something when I made the new<br>
pass or it's something in the pipeline regarding which passes run<br>
first between both PMs. I could just make an AddressSanitizerModule<br>
pass for the new PM, but feel like this should still work even if<br>
AddressSanitizer is added in the new PM and AddressSanitizerModule is<br>
added in legacy.<br>
<br>
- Leo<br>
On Tue, Sep 25, 2018 at 4:09 AM Philip Pfaffe <<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.com</a>> wrote:<br>
><br>
> Frontends _are_ using PassBuilder, but they need to hook into the default pipeline creation to insert the sanitizer passes.<br>
><br>
> On Tue, Sep 25, 2018 at 12:15 PM Fedor Sergeev <<a href="mailto:fedor.sergeev@azul.com" target="_blank">fedor.sergeev@azul.com</a>> wrote:<br>
>><br>
>> Hmm... frontends should be using PassBuilder anyway.<br>
>> And if they are using PassBuilder then they are using PassRegistry.def as well - all the<br>
>> PassBuilder::register*/parse*/is* methods do include PassRegistry.def in their bodies.<br>
>><br>
>> I was under impression that callbacks are primarily for plugins usage.<br>
>><br>
>> regards,<br>
>>   Fedor.<br>
>><br>
>> On 09/25/2018 12:43 PM, Philip Pfaffe wrote:<br>
>><br>
>> Hi Leonard, Fedor,<br>
>><br>
>> while it's true that RegisterPass is not applicable for new-pm passes, PassRegistry.def is not the whole story. Passes in PassRegistry are available for the opt tool. The sanitizers are passes that usually get added to the pipeline by the frontend. There, you need to use PassBuilder's callbacks mechanism to hook the sanitizer into the optimizer.<br>
>><br>
>> Assuming you're willing to contribute your changes, please share your progress! Thank you for making a move on this!<br>
>><br>
>> Cheers,<br>
>> Philip<br>
>><br>
>> On Tue, Sep 25, 2018 at 8:27 AM Fedor Sergeev via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> Leonard,<br>
>>><br>
>>> nope, the PassRegistry stuff is all about legacy pass manager.<br>
>>> legacy namespace has not been extensively used to mark all the<br>
>>> legacy-related stuff<br>
>>> (say, even Pass class which is a base for legacy passes is not under<br>
>>> legacy namespace).<br>
>>><br>
>>> Registration for new-pass-manager passes happens in<br>
>>> lib/Passes/PassRegistry.def.<br>
>>><br>
>>> Usually, when porting from legacy to new the main difference is analysis<br>
>>> handling,<br>
>>> so people factor out the worker code into a method that takes analyses<br>
>>> and call<br>
>>> this function both in legacy and new-pm passes.<br>
>>> In many cases it takes just a handful lines of code.<br>
>>><br>
>>> Feel free to ask questions, if any.<br>
>>><br>
>>> regards,<br>
>>>    Fedor.<br>
>>><br>
>>> On 09/25/2018 02:54 AM, Leonard Chan via llvm-dev wrote:<br>
>>>  > Hi all,<br>
>>>  ><br>
>>>  > I'm attempting to move the AddressSanitizer pass from the legacy<br>
>>>  > PassManager to the new one because the new one has various benefits<br>
>>>  > over legacy and wanted to clarify on something. Does creating the<br>
>>>  > static RegisterPass struct register the pass with the new PassManager?<br>
>>>  ><br>
>>>  > It seems that RegisterPass does the same things that the<br>
>>>  > INITIALIZE_PASS_* macros do but it registers the pass with<br>
>>>  > PassRegistry::getPassRegistry(). What I'm not sure of is if this uses<br>
>>>  > the new PassManager infrastructure. Exploring the code doesn't seem to<br>
>>>  > show that this PassRegistry touches anything in the legacy namespace,<br>
>>>  > but I wanted double confirmation on this.<br>
>>>  ><br>
>>>  > Thanks,<br>
>>>  > Leonard<br>
>>>  > _______________________________________________<br>
>>>  > LLVM Developers mailing list<br>
>>>  > <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>>>  > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>>><br>
>>> _______________________________________________<br>
>>> LLVM Developers mailing list<br>
>>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>><br>
>><br>
</blockquote></div></div>