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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 16 08:53:35 PST 2021


fhahn 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_;
----------------
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`?


================
Comment at: llvm/lib/LTO/LTOBackend.cpp:431
+  legacy::PassManager PM;
+  PM.add(createImmutableModuleSummaryIndexWrapperPass(&CombinedIndex));
+  if (Conf.PreCodeGenPassesHook)
----------------
Can we just keep the name of the pass manager as `CodeGenPasses`?


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