aeubanks added a comment. Looking at BackendUtil.cpp in Clang as well as the Rust code, I'm back to thinking that we should provide a way to to all callbacks. Then in the case of passes added via TargetMachine, we should extend `TargetMachine::registerPassBuilderCallbacks` to also take a `PassBuilder::OptimizationLevel`. Then targets can skip adding optional optimization passes at -O0. Does that make sense? It would allow us to clean up Clang and Rust.
In fact I see in `AMDGPUTargetMachine::adjustPassManager` a check for an optimization level, so some targets are already doing this, although it looks like it's more for codegen and not IR passes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89158/new/ https://reviews.llvm.org/D89158 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits