diff options
| author | bors <bors@rust-lang.org> | 2021-10-08 18:12:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-10-08 18:12:50 +0000 |
| commit | 54bb4fec68cb592e23077896baea072919721573 (patch) | |
| tree | 3b83e54ffa6e0edc726afdbea13d300ecaf914ed /compiler/rustc_codegen_llvm/src/back/write.rs | |
| parent | 87df4dd70f13f248a4d2d22cdd96ee59d161d741 (diff) | |
| parent | 4593d78e96253ccf8440605f8db49c09ece48b8c (diff) | |
| download | rust-54bb4fec68cb592e23077896baea072919721573.tar.gz rust-54bb4fec68cb592e23077896baea072919721573.zip | |
Auto merge of #89666 - rusticstuff:disable_new_llvm_pass_manager_on_s390x_take_two, r=nagisa
Default to disabling the new pass manager for the s390x arch targets. This hack disables the new LLVM pass manager by default for s390x arch targets until the performance issues are fixed (see #89609). The command line option `-Z new-llvm-pass-manager=(yes|no)` continues to take precedence over this default.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/write.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/write.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index ca78254f0c8..380dfd38723 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -377,10 +377,19 @@ fn get_pgo_sample_use_path(config: &ModuleConfig) -> Option<CString> { .map(|path_buf| CString::new(path_buf.to_string_lossy().as_bytes()).unwrap()) } -pub(crate) fn should_use_new_llvm_pass_manager(config: &ModuleConfig) -> bool { +pub(crate) fn should_use_new_llvm_pass_manager( + cgcx: &CodegenContext<LlvmCodegenBackend>, + config: &ModuleConfig, +) -> bool { // The new pass manager is enabled by default for LLVM >= 13. // This matches Clang, which also enables it since Clang 13. - config.new_llvm_pass_manager.unwrap_or_else(|| llvm_util::get_version() >= (13, 0, 0)) + + // 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 + config + .new_llvm_pass_manager + .unwrap_or_else(|| cgcx.target_arch != "s390x" && llvm_util::get_version() >= (13, 0, 0)) } pub(crate) unsafe fn optimize_with_new_llvm_pass_manager( @@ -482,7 +491,7 @@ pub(crate) unsafe fn optimize( } if let Some(opt_level) = config.opt_level { - if should_use_new_llvm_pass_manager(config) { + if should_use_new_llvm_pass_manager(cgcx, config) { let opt_stage = match cgcx.lto { Lto::Fat => llvm::OptStage::PreLinkFatLTO, Lto::Thin | Lto::ThinLocal => llvm::OptStage::PreLinkThinLTO, |
