[PATCH] D94547: [lld-macho] Run ObjCContractPass during LTO

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 10:51:50 PST 2021


int3 added inline comments.


================
Comment at: llvm/include/llvm/LTO/Config.h:47
   std::vector<std::string> PassPlugins;
+  std::function<void(legacy::PassManager &)> PreCodeGenPassesHook;
   Optional<Reloc::Model> RelocModel = Reloc::PIC_;
----------------
fhahn wrote:
> int3 wrote:
> > I initially tried making this a vector of `Pass *`, but it appears that creating the ObjCContractPass too early results in an error later:
> > 
> > ```
> > Assertion failed: (!Resolver && "Resolver is already set"), function setResolver, file /Users/jezng/src/llvm-project/llvm/lib/IR/Pass.cpp
> > ```
> > 
> > Using this hook to delay initialization seems to work, though I'm not sure if it's the right solution.
> Can you a doc-comment for `PreCodeGenPassesHook`?
For sure, was planning to do that. Just wanted to make sure that using a hook to delay initialization was the right approach here...


================
Comment at: llvm/lib/LTO/LTOBackend.cpp:431
+  legacy::PassManager PM;
+  PM.add(createImmutableModuleSummaryIndexWrapperPass(&CombinedIndex));
+  if (Conf.PreCodeGenPassesHook)
----------------
fhahn wrote:
> Can we just keep the name of the pass manager as `CodeGenPasses`?
I'd thought that since we are now including pre-codegen passes in it, the old name was a bit of a misnomer... but I don't feel strongly about it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94547



More information about the llvm-commits mailing list