[PATCH] D96456: [ThinLTO, NewPM] Add Config::OptPassBuilderHook

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 21:26:39 PST 2021


aeubanks added a comment.

This makes sense to me, we need to add the PassBuilder callbacks in both the prelink/normal and postlink steps, and those are separated.



================
Comment at: llvm/include/llvm/LTO/Config.h:54
+  /// For adding passes that run by opt.
+  std::function<void(PassBuilder &)> OptPassBuilderHook;
   Optional<Reloc::Model> RelocModel = Reloc::PIC_;
----------------
tejohnson wrote:
> Is this essentially the new PM equivalent to PreCodeGenPassesHook above (since this new hook runs at the end of opt)?
> Also, might be good to name this like OptimizerLastPassBuilderHook or something like that to indicate its position within the opt pipeline.
I think the idea is that this callback adds PassBuilder callbacks in various parts of the the pipeline. Perhaps just `PassBuilderHook`? It's weird that we only allow one, but I guess we can make it a vector in the future if necessary.


================
Comment at: llvm/lib/LTO/LTOBackend.cpp:327-328
 
+  if (Conf.OptPassBuilderHook)
+    Conf.OptPassBuilderHook(PB);
+
----------------
this should go in `runNewPMPasses()`, not `runNewPMCustomPasses()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96456



More information about the cfe-commits mailing list