Deprecate no-op codegen option `-Cinline-threshold=...` · rust-lang/rust@f5f067b

File tree

7 files changed

lines changed

    • rustc_codegen_llvm/src/back

  • src/doc/rustc/src/codegen-options

7 files changed

lines changed

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,

Original file line numberDiff line numberDiff line change

@@ -1136,6 +1136,10 @@ pub fn describe_flag_categories(early_dcx: &EarlyDiagCtxt, matches: &Matches) ->

11361136

early_dcx.early_warn("the `-Cno-stack-check` flag is deprecated and does nothing");

11371137

}

11381138
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=...`)");

1141+

}

1142+
11391143

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

11401144

let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));

11411145
Original file line numberDiff line numberDiff line change

@@ -1485,7 +1485,8 @@ options! {

14851485

incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],

14861486

"enable incremental compilation"),

14871487

inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED],

1488-

"set the threshold for inlining a function"),

1488+

"this option is deprecated and does nothing \

1489+

(consider using `-Cllvm-args=--inline-threshold=...`)"),

14891490

#[rustc_lint_opt_deny_field_access("use `Session::instrument_coverage` instead of this field")]

14901491

instrument_coverage: InstrumentCoverage = (InstrumentCoverage::No, parse_instrument_coverage, [TRACKED],

14911492

"instrument the generated code to support LLVM source-based code coverage reports \

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
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+