@@ -377,10 +377,19 @@ fn get_pgo_sample_use_path(config: &ModuleConfig) -> Option<CString> {
377
377
. map ( |path_buf| CString :: new ( path_buf. to_string_lossy ( ) . as_bytes ( ) ) . unwrap ( ) )
378
378
}
379
379
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 {
381
384
// The new pass manager is enabled by default for LLVM >= 13.
382
385
// 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 ) )
384
393
}
385
394
386
395
pub ( crate ) unsafe fn optimize_with_new_llvm_pass_manager (
@@ -482,7 +491,7 @@ pub(crate) unsafe fn optimize(
482
491
}
483
492
484
493
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) {
486
495
let opt_stage = match cgcx. lto {
487
496
Lto :: Fat => llvm:: OptStage :: PreLinkFatLTO ,
488
497
Lto :: Thin | Lto :: ThinLocal => llvm:: OptStage :: PreLinkThinLTO ,
0 commit comments