[llvm] [Analysis] Remove global state from `PluginInline{Advisor,Order}Analysis`. (PR #114615)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 13:00:42 PST 2024


aeubanks wrote:

> This causes issues when pipelines using plugins and pipelines not using plugins are run in the same process.

I think I'm not understanding how

```
llvmGetPassPluginInfo() {
 return {
   [](PassBuilder &PB) {
             PB.registerPipelineStartEPCallback(
                 [](ModulePassManager &MPM, OptimizationLevel Level) {
                   MPM.addPass(DefaultDynamicAdvisor());
                 });
           }};
 }
```

with this patch applied is any different from just

```
llvmGetPassPluginInfo() {
 return {
   [](PassBuilder &PB) {
             PB.registerAnalysisRegistrationCallback(
                 [](ModuleAnalysisManager & MAM) {
                   PluginInlineAdvisorAnalysis PA(defaultAdvisorFactory);
                   MAM.registerPass([&] { return PA; });
                 });
           }};
 }
```

with the `DefaultDynamicAdvisor` pass removed. `registerAnalysisRegistrationCallback` seems like a cleaner way of registering the inline advisor unless I'm not understanding some other detail of `DefaultDynamicAdvisor`

https://github.com/llvm/llvm-project/pull/114615


More information about the llvm-commits mailing list