[PATCH] D130889: [llvm] Introduce a pass plugin registry and loader

Philippe Virouleau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 07:13:21 PDT 2022


viroulep added a comment.

Thanks for your review @w2yehia!



================
Comment at: llvm/lib/Passes/PassPluginLoader.cpp:23
+void PassPluginLoader::operator=(const std::string &Filename) {
+  sys::SmartScopedLock<true> Lock(*PluginsLock);
+  auto PassPlugin = PassPlugin::Load(Filename);
----------------
w2yehia wrote:
> why do we need a lock? 
> Is there a use case where multiple threads enter this function.
> Right now, the only place we create a `PassPluginLoader` is in `cl::opt<PassPluginLoader> PassPlugins`.
That's a very good question that I couldn't answer: I based the implementation on what is done over in [[ https://github.com/llvm/llvm-project/blame/main/llvm/lib/Support/PluginLoader.cpp | PluginLoader ]], but I too wondered why it was guarded ([[ https://github.com/llvm/llvm-project/commit/bee30f58fb3f65d980fa15c14aa9546145521619 | this commit ]] introduces it but I couldn't find more details).

I'm fine with removing it unless someone can provide a use case where we need it; I'll update the patch!



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130889



More information about the llvm-commits mailing list