about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorAxel Cohen <axel.cohen@eshard.com>2021-12-20 14:50:03 +0100
committerAxel Cohen <axel.cohen@eshard.com>2021-12-20 14:50:03 +0100
commitf431df0d7f4f56e5c4c6a73023126e1b02104436 (patch)
tree09e37aef099da66c99a89865d5ec38b040a24b2f /compiler/rustc_codegen_llvm/src
parent052961b0138b38a9da26e88e3db6aac19e8c070c (diff)
downloadrust-f431df0d7f4f56e5c4c6a73023126e1b02104436.tar.gz
rust-f431df0d7f4f56e5c4c6a73023126e1b02104436.zip
Load new pass manager plugins only if the new pm is actually used
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 53571e8cb32..863a347e121 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -119,11 +119,11 @@ unsafe fn configure_llvm(sess: &Session) {
 
     llvm::LLVMInitializePasses();
 
-    let use_new_llvm_pm_plugin_register =
-        sess.opts.debugging_opts.new_llvm_pass_manager.unwrap_or(false);
-
-    // Use the legacy pm registration if the new_llvm_pass_manager option isn't explicitly enabled
-    if !use_new_llvm_pm_plugin_register {
+    // Use the legacy plugin registration if we don't use the new pass manager
+    if !should_use_new_llvm_pass_manager(
+        &sess.opts.debugging_opts.new_llvm_pass_manager,
+        &sess.target.arch,
+    ) {
         // Register LLVM plugins by loading them into the compiler process.
         for plugin in &sess.opts.debugging_opts.llvm_plugins {
             let lib = Library::new(plugin).unwrap_or_else(|e| bug!("couldn't load plugin: {}", e));