aeubanks added a comment.

In D96803#2571316 <https://reviews.llvm.org/D96803#2571316>, @zatrazz wrote:

> In D96803#2569436 <https://reviews.llvm.org/D96803#2569436>, @aeubanks wrote:
>
>> In D96803#2568179 <https://reviews.llvm.org/D96803#2568179>, @zatrazz wrote:
>>
>>> In D96803#2566322 <https://reviews.llvm.org/D96803#2566322>, @aeubanks 
>>> wrote:
>>>
>>>> why is this now a module pass?
>>>
>>> Mainly to avoid the default rule from new pass manager to *not* apply any 
>>> FunctionPass for optnone (which is the main issue for PR49143). Is there a 
>>> better way to accomplish it? I noted also that 
>>> createModuleToFunctionPassAdaptor basically creates a adaptor that applies 
>>> the pass to all function on the module.
>>
>> It's always good to make the pass as specific as possible (e.g. prefer a 
>> function pass rather than a module pass) so it doesn't have to worry about 
>> infra. For example, just iterating over functions doesn't skip declarations.
>
> I modeled it after AlwaysInlinerPass, since it seems that it was enabled at 
> -O0 as well.

AlwaysInlinerPass is a module pass because it does interprocedural changes. 
EntryExitInstrumenterPass works on one function at a time, which should be 
modeled as a function pass.

> To keep EntryExitInstrumenterPass a function pass and enable it with -O0 I 
> think we will need a way to communicate to the pass manager that the pass 
> should be run even with optnone, my understanding was that a ModulePass will 
> the way to do it. Do we have a way to advertise that a function pass should 
> be run regardless of ' optnone' ?

That's what `isRequired()` is for...

Basically we need two changes. One is add `isRequired()` to 
EntryExitInstrumenterPass, the other is to run EntryExitInstrumenterPass under 
-O0 as well by removing the check in BackendUtil.cpp (or by changing it to 
`CodeGenOpts.InstrumentFunctions || ...` as you've done). Please keep the pass 
as a function pass.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96803/new/

https://reviews.llvm.org/D96803

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to