Skip to content

Commit faa28be

Browse files
Rollup merge of #124712 - Enselic:deprecate-inline-threshold, r=pnkfelix
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. Recommend using `-Cllvm-args=--inline-threshold=...` instead. Closes #89742 which is E-help-wanted.
2 parents 00e5f58 + f5f067b commit faa28be

File tree

8 files changed

+17
-22
lines changed

8 files changed

+17
-22
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

-3
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,6 @@ pub(crate) unsafe fn llvm_optimize(
564564

565565
let llvm_plugins = config.llvm_plugins.join(",");
566566

567-
// FIXME: NewPM doesn't provide a facility to pass custom InlineParams.
568-
// We would have to add upstream support for this first, before we can support
569-
// config.inline_threshold and our more aggressive default thresholds.
570567
let result = llvm::LLVMRustOptimize(
571568
module.module_llvm.llmod(),
572569
&*module.module_llvm.tm,

compiler/rustc_codegen_ssa/src/back/write.rs

-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ pub struct ModuleConfig {
120120
pub vectorize_loop: bool,
121121
pub vectorize_slp: bool,
122122
pub merge_functions: bool,
123-
pub inline_threshold: Option<u32>,
124123
pub emit_lifetime_markers: bool,
125124
pub llvm_plugins: Vec<String>,
126125
}
@@ -280,7 +279,6 @@ impl ModuleConfig {
280279
}
281280
},
282281

283-
inline_threshold: sess.opts.cg.inline_threshold,
284282
emit_lifetime_markers: sess.emit_lifetime_markers(),
285283
llvm_plugins: if_regular!(sess.opts.unstable_opts.llvm_plugins.clone(), vec![]),
286284
}

compiler/rustc_driver_impl/src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,11 @@ pub fn describe_flag_categories(early_dcx: &EarlyDiagCtxt, matches: &Matches) ->
11331133
}
11341134

11351135
if cg_flags.iter().any(|x| *x == "no-stack-check") {
1136-
early_dcx.early_warn("the --no-stack-check flag is deprecated and does nothing");
1136+
early_dcx.early_warn("the `-Cno-stack-check` flag is deprecated and does nothing");
1137+
}
1138+
1139+
if cg_flags.iter().any(|x| x.starts_with("inline-threshold")) {
1140+
early_dcx.early_warn("the `-Cinline-threshold` flag is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)");
11371141
}
11381142

11391143
if cg_flags.iter().any(|x| *x == "passes=list") {

compiler/rustc_session/src/options.rs

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

src/doc/rustc/src/codegen-options/index.md

+3-14
Original file line numberDiff line numberDiff line change
@@ -184,20 +184,9 @@ incremental files will be stored.
184184

185185
## inline-threshold
186186

187-
This option lets you set the default threshold for inlining a function. It
188-
takes an unsigned integer as a value. Inlining is based on a cost model, where
189-
a higher threshold will allow more inlining.
190-
191-
The default depends on the [opt-level](#opt-level):
192-
193-
| opt-level | Threshold |
194-
|-----------|-----------|
195-
| 0 | N/A, only inlines always-inline functions |
196-
| 1 | N/A, only inlines always-inline functions and LLVM lifetime intrinsics |
197-
| 2 | 225 |
198-
| 3 | 275 |
199-
| s | 75 |
200-
| z | 25 |
187+
This option is deprecated and does nothing.
188+
189+
Consider using `-Cllvm-args=--inline-threshold=...`.
201190

202191
## instrument-coverage
203192

tests/ui/codegen/issue-82833-slice-miscompile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ run-pass
2-
//@ compile-flags: -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2
2+
//@ compile-flags: -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2
33

44
// Make sure LLVM does not miscompile this.
55

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ check-pass
2+
//@ compile-flags: -Cinline-threshold=666
3+
4+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
warning: the `-Cinline-threshold` flag is deprecated and does nothing (consider using `-Cllvm-args=--inline-threshold=...`)
2+

0 commit comments

Comments
 (0)