rustc_codegen_llvm: move should_use_new_llvm_pass_manager function to llvm_util

This commit is contained in:
Axel Cohen
2021-12-20 14:49:04 +01:00
parent 75d1208df8
commit 052961b013
3 changed files with 19 additions and 18 deletions

View File

@@ -415,3 +415,13 @@ pub fn tune_cpu(sess: &Session) -> Option<&str> {
let name = sess.opts.debugging_opts.tune_cpu.as_ref()?;
Some(handle_native(name))
}
pub(crate) fn should_use_new_llvm_pass_manager(user_opt: &Option<bool>, target_arch: &str) -> bool {
// The new pass manager is enabled by default for LLVM >= 13.
// This matches Clang, which also enables it since Clang 13.
// FIXME: There are some perf issues with the new pass manager
// when targeting s390x, so it is temporarily disabled for that
// arch, see https://github.com/rust-lang/rust/issues/89609
user_opt.unwrap_or_else(|| target_arch != "s390x" && llvm_util::get_version() >= (13, 0, 0))
}