Skip to content

Commit

Permalink
Fix conditions for using legacy or new pm plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
eskarn committed Dec 13, 2021
1 parent c4f29fa commit 75d1208
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ unsafe fn configure_llvm(sess: &Session) {
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 {
if !use_new_llvm_pm_plugin_register {
// 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));
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ impl ModuleConfig {
inline_threshold: sess.opts.cg.inline_threshold,
new_llvm_pass_manager: sess.opts.debugging_opts.new_llvm_pass_manager,
emit_lifetime_markers: sess.emit_lifetime_markers(),
llvm_plugins: if_regular!(sess.opts.debugging_opts.llvm_plugins.clone(), vec![]),
llvm_plugins: if sess.opts.debugging_opts.new_llvm_pass_manager.unwrap_or(false) {
if_regular!(sess.opts.debugging_opts.llvm_plugins.clone(), vec![])
} else {
vec![]
},
}
}

Expand Down

0 comments on commit 75d1208

Please sign in to comment.