Replacement for LTO of the legacy pass manager in LLVM 15?

Hello all,

I am helping to prepare the OPAM release of the LLVM 15 OCaml bindings, with modifications to ease the transition from LLVM 14 to LLVM 15. However, I am not an expert on the nooks and crannies of the LLVM API. It appears that in LLVM 15, the LTO pipeline of the legacy pass manager was removed. Some clients of the OCaml bindings used this feature, and I can’t tell what the alternative is supposed to be. For context, see: Where is pass-manager gone in LLVM 15? · Issue #10 · kit-ty-kate/llvm-dune · GitHub

Is there a new API to use instead?

Pass "lto<O2>" to LLVMRunPasses.