Skip to content

Commit be39c26

Browse files
committed
Deprecate codegen option inline-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.
1 parent ce7c3bf commit be39c26

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,6 @@ pub(crate) unsafe fn llvm_optimize(
563563

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

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

compiler/rustc_session/src/options.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,8 @@ options! {
15021502
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
15031503
"enable incremental compilation"),
15041504
inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED],
1505-
"set the threshold for inlining a function"),
1505+
"this option is deprecated and does nothing \
1506+
(consider using `-Cllvm-args=--inline-threshold=...`)"),
15061507
#[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")]
15071508
instrument_coverage: InstrumentCoverage = (InstrumentCoverage::No, parse_instrument_coverage, [TRACKED],
15081509
"instrument the generated code to support LLVM source-based code coverage reports \

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

Lines changed: 3 additions & 14 deletions
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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)