Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1f631e8

Browse files
committedApr 24, 2022
Auto merge of #96369 - matthiaskrgr:rollup-q18w4v2, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #95395 (Better error message for `_` in function signature in `impl Trait for Ty`) - #96090 (Implement MIR opt unit tests) - #96107 ([test] Add test cases for untested functions for VecDeque) - #96212 (Use revisions instead of nll compare mode for `/regions/` ui tests) - #96215 (Drop support for legacy PM with LLVM 15) - #96366 (bootstrap: Remove dead code in rustdoc shim) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 18f314e + f5837f8 commit 1f631e8

File tree

206 files changed

+1602
-621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+1602
-621
lines changed
 

‎compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ pub(crate) fn run_pass_manager(
625625
if thin {
626626
llvm::LLVMRustPassManagerBuilderPopulateThinLTOPassManager(b, pm);
627627
} else {
628-
llvm::LLVMPassManagerBuilderPopulateLTOPassManager(
628+
llvm::LLVMRustPassManagerBuilderPopulateLTOPassManager(
629629
b, pm, /* Internalize = */ False, /* RunInliner = */ True,
630630
);
631631
}

‎compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,12 @@ pub(crate) unsafe fn optimize(
523523
let module_name = module.name.clone();
524524
let module_name = Some(&module_name[..]);
525525

526+
if let Some(false) = config.new_llvm_pass_manager && llvm_util::get_version() >= (15, 0, 0) {
527+
diag_handler.warn(
528+
"ignoring `-Z new-llvm-pass-manager=no`, which is no longer supported with LLVM 15",
529+
);
530+
}
531+
526532
if config.emit_no_opt_bc {
527533
let out = cgcx.output_filenames.temp_path_ext("no-opt.bc", module_name);
528534
let out = path_to_c_string(&out);
@@ -628,8 +634,8 @@ pub(crate) unsafe fn optimize(
628634
extra_passes.as_ptr(),
629635
extra_passes.len() as size_t,
630636
);
631-
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(b, fpm);
632-
llvm::LLVMPassManagerBuilderPopulateModulePassManager(b, mpm);
637+
llvm::LLVMRustPassManagerBuilderPopulateFunctionPassManager(b, fpm);
638+
llvm::LLVMRustPassManagerBuilderPopulateModulePassManager(b, mpm);
633639
});
634640

635641
have_name_anon_globals_pass = have_name_anon_globals_pass || prepare_for_thin_lto;
@@ -1085,7 +1091,7 @@ pub unsafe fn with_llvm_pmb(
10851091
// Create the PassManagerBuilder for LLVM. We configure it with
10861092
// reasonable defaults and prepare it to actually populate the pass
10871093
// manager.
1088-
let builder = llvm::LLVMPassManagerBuilderCreate();
1094+
let builder = llvm::LLVMRustPassManagerBuilderCreate();
10891095
let opt_size = config.opt_size.map_or(llvm::CodeGenOptSizeNone, |x| to_llvm_opt_settings(x).1);
10901096
let inline_threshold = config.inline_threshold;
10911097
let pgo_gen_path = get_pgo_gen_path(config);
@@ -1102,14 +1108,9 @@ pub unsafe fn with_llvm_pmb(
11021108
pgo_gen_path.as_ref().map_or(ptr::null(), |s| s.as_ptr()),
11031109
pgo_use_path.as_ref().map_or(ptr::null(), |s| s.as_ptr()),
11041110
pgo_sample_use_path.as_ref().map_or(ptr::null(), |s| s.as_ptr()),
1111+
opt_size as c_int,
11051112
);
11061113

1107-
llvm::LLVMPassManagerBuilderSetSizeLevel(builder, opt_size as u32);
1108-
1109-
if opt_size != llvm::CodeGenOptSizeNone {
1110-
llvm::LLVMPassManagerBuilderSetDisableUnrollLoops(builder, 1);
1111-
}
1112-
11131114
llvm::LLVMRustAddBuilderLibraryInfo(builder, llmod, config.no_builtins);
11141115

11151116
// Here we match what clang does (kinda). For O0 we only inline
@@ -1118,16 +1119,16 @@ pub unsafe fn with_llvm_pmb(
11181119
// thresholds copied from clang.
11191120
match (opt_level, opt_size, inline_threshold) {
11201121
(.., Some(t)) => {
1121-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, t);
1122+
llvm::LLVMRustPassManagerBuilderUseInlinerWithThreshold(builder, t);
11221123
}
11231124
(llvm::CodeGenOptLevel::Aggressive, ..) => {
1124-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, 275);
1125+
llvm::LLVMRustPassManagerBuilderUseInlinerWithThreshold(builder, 275);
11251126
}
11261127
(_, llvm::CodeGenOptSizeDefault, _) => {
1127-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, 75);
1128+
llvm::LLVMRustPassManagerBuilderUseInlinerWithThreshold(builder, 75);
11281129
}
11291130
(_, llvm::CodeGenOptSizeAggressive, _) => {
1130-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, 25);
1131+
llvm::LLVMRustPassManagerBuilderUseInlinerWithThreshold(builder, 25);
11311132
}
11321133
(llvm::CodeGenOptLevel::None, ..) => {
11331134
llvm::LLVMRustAddAlwaysInlinePass(builder, config.emit_lifetime_markers);
@@ -1136,12 +1137,12 @@ pub unsafe fn with_llvm_pmb(
11361137
llvm::LLVMRustAddAlwaysInlinePass(builder, config.emit_lifetime_markers);
11371138
}
11381139
(llvm::CodeGenOptLevel::Default, ..) => {
1139-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder, 225);
1140+
llvm::LLVMRustPassManagerBuilderUseInlinerWithThreshold(builder, 225);
11401141
}
11411142
}
11421143

11431144
f(builder);
1144-
llvm::LLVMPassManagerBuilderDispose(builder);
1145+
llvm::LLVMRustPassManagerBuilderDispose(builder);
11451146
}
11461147

11471148
// Create a `__imp_<symbol> = &symbol` global for every public static `symbol`.

0 commit comments

Comments
 (0)
Please sign in to comment.