Deprecate no-op codegen option -Cinline-threshold=...

This deprecates `-Cinline-threshold` since using it has no effect. This
has been the case since the new LLVM pass manager started being used,
more than 2 years ago.
This commit is contained in:
Martin Nordholts 2024-05-04 16:21:50 +02:00
parent 651ff643ae
commit f5f067bf9d
7 changed files with 15 additions and 18 deletions

View File

@ -564,9 +564,6 @@ pub(crate) unsafe fn llvm_optimize(
let llvm_plugins = config.llvm_plugins.join(","); let llvm_plugins = config.llvm_plugins.join(",");
// FIXME: NewPM doesn't provide a facility to pass custom InlineParams.
// We would have to add upstream support for this first, before we can support
// config.inline_threshold and our more aggressive default thresholds.
let result = llvm::LLVMRustOptimize( let result = llvm::LLVMRustOptimize(
module.module_llvm.llmod(), module.module_llvm.llmod(),
&*module.module_llvm.tm, &*module.module_llvm.tm,

View File

@ -1136,6 +1136,10 @@ pub fn describe_flag_categories(early_dcx: &EarlyDiagCtxt, matches: &Matches) ->
early_dcx.early_warn("the `-Cno-stack-check` flag is deprecated and does nothing"); early_dcx.early_warn("the `-Cno-stack-check` flag is deprecated and does nothing");
} }
if cg_flags.iter().any(|x| x.starts_with("inline-threshold")) {
early_dcx.early_warn("the `-Cinline-threshold` flag is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)");
}
if cg_flags.iter().any(|x| *x == "passes=list") { if cg_flags.iter().any(|x| *x == "passes=list") {
let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend=")); let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));

View File

@ -1485,7 +1485,8 @@ options! {
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED], incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
"enable incremental compilation"), "enable incremental compilation"),
inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED], inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED],
"set the threshold for inlining a function"), "this option is deprecated and does nothing \
(consider using `-Cllvm-args=--inline-threshold=...`)"),
#[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")] #[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")]
instrument_coverage: InstrumentCoverage = (InstrumentCoverage::No, parse_instrument_coverage, [TRACKED], instrument_coverage: InstrumentCoverage = (InstrumentCoverage::No, parse_instrument_coverage, [TRACKED],
"instrument the generated code to support LLVM source-based code coverage reports \ "instrument the generated code to support LLVM source-based code coverage reports \

View File

@ -184,20 +184,9 @@ incremental files will be stored.
## inline-threshold ## inline-threshold
This option lets you set the default threshold for inlining a function. It This option is deprecated and does nothing.
takes an unsigned integer as a value. Inlining is based on a cost model, where
a higher threshold will allow more inlining.
The default depends on the [opt-level](#opt-level): Consider using `-Cllvm-args=--inline-threshold=...`.
| opt-level | Threshold |
|-----------|-----------|
| 0 | N/A, only inlines always-inline functions |
| 1 | N/A, only inlines always-inline functions and LLVM lifetime intrinsics |
| 2 | 225 |
| 3 | 275 |
| s | 75 |
| z | 25 |
## instrument-coverage ## instrument-coverage

View File

@ -1,5 +1,5 @@
//@ run-pass //@ run-pass
//@ compile-flags: -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2 //@ compile-flags: -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2
// Make sure LLVM does not miscompile this. // Make sure LLVM does not miscompile this.

View File

@ -0,0 +1,4 @@
//@ check-pass
//@ compile-flags: -Cinline-threshold=666
fn main() {}

View File

@ -0,0 +1,2 @@
warning: the `-Cinline-threshold` flag is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)