Skip to content

Commit be01f42

Browse files
committed
Enable new pass manager on LLVM 13
The new pass manager is enabled by default in clang since Clang/LLVM 13. While the discussion about this is still ongoing (https://lists.llvm.org/pipermail/llvm-dev/2021-August/152305.html) it's expected that support for the legacy pass manager will be dropped either in LLVM 14 or 15. This switches us to use the new pass manager if LLVM >= 13 is used.
1 parent 60fe8b3 commit be01f42

File tree

1 file changed

+3
-2
lines changed
  • compiler/rustc_codegen_llvm/src/back

1 file changed

+3
-2
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,9 @@ fn get_pgo_use_path(config: &ModuleConfig) -> Option<CString> {
370370
}
371371

372372
pub(crate) fn should_use_new_llvm_pass_manager(config: &ModuleConfig) -> bool {
373-
// The new pass manager is disabled by default.
374-
config.new_llvm_pass_manager.unwrap_or(false)
373+
// The new pass manager is enabled by default for LLVM >= 13.
374+
// This matches Clang, which also enables it since Clang 13.
375+
config.new_llvm_pass_manager.unwrap_or_else(|| llvm_util::get_version() >= (13, 0, 0))
375376
}
376377

377378
pub(crate) unsafe fn optimize_with_new_llvm_pass_manager(

0 commit comments

Comments
 (0)