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

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 10:08:58 PST 2021


int3 added a comment.

Since we're only running the ObjCContractPass via the one pass manager in `codegen`, there's actually no real need to add the `--[no-]lto-legacy-pass-manager` flags in this diff. But it probably doesn't hurt to leave it in, along with the test, just to make sure that any future migrations to the non-legacy PM don't break behavior



================
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_;
----------------
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.


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