1
Fork 0

Load new pass manager plugins only if the new pm is actually used

This commit is contained in:
Axel Cohen 2021-12-20 14:50:03 +01:00
parent 052961b013
commit f431df0d7f
2 changed files with 6 additions and 10 deletions

View file

@ -119,11 +119,11 @@ unsafe fn configure_llvm(sess: &Session) {
llvm::LLVMInitializePasses(); llvm::LLVMInitializePasses();
let use_new_llvm_pm_plugin_register = // Use the legacy plugin registration if we don't use the new pass manager
sess.opts.debugging_opts.new_llvm_pass_manager.unwrap_or(false); if !should_use_new_llvm_pass_manager(
&sess.opts.debugging_opts.new_llvm_pass_manager,
// Use the legacy pm registration if the new_llvm_pass_manager option isn't explicitly enabled &sess.target.arch,
if !use_new_llvm_pm_plugin_register { ) {
// Register LLVM plugins by loading them into the compiler process. // Register LLVM plugins by loading them into the compiler process.
for plugin in &sess.opts.debugging_opts.llvm_plugins { for plugin in &sess.opts.debugging_opts.llvm_plugins {
let lib = Library::new(plugin).unwrap_or_else(|e| bug!("couldn't load plugin: {}", e)); let lib = Library::new(plugin).unwrap_or_else(|e| bug!("couldn't load plugin: {}", e));

View file

@ -261,11 +261,7 @@ impl ModuleConfig {
inline_threshold: sess.opts.cg.inline_threshold, inline_threshold: sess.opts.cg.inline_threshold,
new_llvm_pass_manager: sess.opts.debugging_opts.new_llvm_pass_manager, new_llvm_pass_manager: sess.opts.debugging_opts.new_llvm_pass_manager,
emit_lifetime_markers: sess.emit_lifetime_markers(), emit_lifetime_markers: sess.emit_lifetime_markers(),
llvm_plugins: if sess.opts.debugging_opts.new_llvm_pass_manager.unwrap_or(false) { llvm_plugins: if_regular!(sess.opts.debugging_opts.llvm_plugins.clone(), vec![]),
if_regular!(sess.opts.debugging_opts.llvm_plugins.clone(), vec![])
} else {
vec![]
},
} }
} }