@@ -377,10 +377,19 @@ fn get_pgo_sample_use_path(config: &ModuleConfig) -> Option<CString> {
377377 . map ( |path_buf| CString :: new ( path_buf. to_string_lossy ( ) . as_bytes ( ) ) . unwrap ( ) )
378378}
379379
380- pub ( crate ) fn should_use_new_llvm_pass_manager ( config : & ModuleConfig ) -> bool {
380+ pub ( crate ) fn should_use_new_llvm_pass_manager (
381+ cgcx : & CodegenContext < LlvmCodegenBackend > ,
382+ config : & ModuleConfig ,
383+ ) -> bool {
381384 // The new pass manager is enabled by default for LLVM >= 13.
382385 // This matches Clang, which also enables it since Clang 13.
383- config. new_llvm_pass_manager . unwrap_or_else ( || llvm_util:: get_version ( ) >= ( 13 , 0 , 0 ) )
386+
387+ // FIXME: There are some perf issues with the new pass manager
388+ // when targeting s390x, so it is temporarily disabled for that
389+ // arch, see https://github.com/rust-lang/rust/issues/89609
390+ config
391+ . new_llvm_pass_manager
392+ . unwrap_or_else ( || cgcx. target_arch != "s390x" && llvm_util:: get_version ( ) >= ( 13 , 0 , 0 ) )
384393}
385394
386395pub ( crate ) unsafe fn optimize_with_new_llvm_pass_manager (
@@ -482,7 +491,7 @@ pub(crate) unsafe fn optimize(
482491 }
483492
484493 if let Some ( opt_level) = config. opt_level {
485- if should_use_new_llvm_pass_manager ( config) {
494+ if should_use_new_llvm_pass_manager ( cgcx , config) {
486495 let opt_stage = match cgcx. lto {
487496 Lto :: Fat => llvm:: OptStage :: PreLinkFatLTO ,
488497 Lto :: Thin | Lto :: ThinLocal => llvm:: OptStage :: PreLinkThinLTO ,
0 commit comments