Skip to content

Commit 75d1208

Browse files
committed
Fix conditions for using legacy or new pm plugins
1 parent c4f29fa commit 75d1208

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: compiler/rustc_codegen_llvm/src/llvm_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ unsafe fn configure_llvm(sess: &Session) {
123123
sess.opts.debugging_opts.new_llvm_pass_manager.unwrap_or(false);
124124

125125
// Use the legacy pm registration if the new_llvm_pass_manager option isn't explicitly enabled
126-
if use_new_llvm_pm_plugin_register {
126+
if !use_new_llvm_pm_plugin_register {
127127
// Register LLVM plugins by loading them into the compiler process.
128128
for plugin in &sess.opts.debugging_opts.llvm_plugins {
129129
let lib = Library::new(plugin).unwrap_or_else(|e| bug!("couldn't load plugin: {}", e));

Diff for: compiler/rustc_codegen_ssa/src/back/write.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ impl ModuleConfig {
261261
inline_threshold: sess.opts.cg.inline_threshold,
262262
new_llvm_pass_manager: sess.opts.debugging_opts.new_llvm_pass_manager,
263263
emit_lifetime_markers: sess.emit_lifetime_markers(),
264-
llvm_plugins: if_regular!(sess.opts.debugging_opts.llvm_plugins.clone(), vec![]),
264+
llvm_plugins: if sess.opts.debugging_opts.new_llvm_pass_manager.unwrap_or(false) {
265+
if_regular!(sess.opts.debugging_opts.llvm_plugins.clone(), vec![])
266+
} else {
267+
vec![]
268+
},
265269
}
266270
}
267271

0 commit comments

Comments
 (0)