Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 500aecc

Browse files
committed
Use optional values for inlining thresholds
Turn inlining threshold into optional values to make it possible to configure different defaults depending on the current mir-opt-level.
1 parent f895f1c commit 500aecc

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

compiler/rustc_interface/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ fn test_debugging_options_tracking_hash() {
558558
tracked!(human_readable_cgu_names, true);
559559
tracked!(inline_in_all_cgus, Some(true));
560560
tracked!(inline_mir, Some(true));
561-
tracked!(inline_mir_threshold, 123);
562-
tracked!(inline_mir_hint_threshold, 123);
561+
tracked!(inline_mir_threshold, Some(123));
562+
tracked!(inline_mir_hint_threshold, Some(123));
563563
tracked!(insert_sideeffect, true);
564564
tracked!(instrument_coverage, true);
565565
tracked!(instrument_mcount, true);

compiler/rustc_mir/src/transform/inline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ impl Inliner<'tcx> {
349349
let tcx = self.tcx;
350350

351351
let mut threshold = if callee_attrs.requests_inline() {
352-
self.tcx.sess.opts.debugging_opts.inline_mir_hint_threshold
352+
self.tcx.sess.opts.debugging_opts.inline_mir_hint_threshold.unwrap_or(100)
353353
} else {
354-
self.tcx.sess.opts.debugging_opts.inline_mir_threshold
354+
self.tcx.sess.opts.debugging_opts.inline_mir_threshold.unwrap_or(50)
355355
};
356356

357357
// Give a bonus functions with a small number of blocks,

compiler/rustc_session/src/options.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,9 +959,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
959959
"verify incr. comp. hashes of green query instances (default: no)"),
960960
inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED],
961961
"enable MIR inlining (default: no)"),
962-
inline_mir_threshold: usize = (50, parse_uint, [TRACKED],
962+
inline_mir_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
963963
"a default MIR inlining threshold (default: 50)"),
964-
inline_mir_hint_threshold: usize = (100, parse_uint, [TRACKED],
964+
inline_mir_hint_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
965965
"inlining threshold for functions with inline hint (default: 100)"),
966966
inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
967967
"control whether `#[inline]` functions are in all CGUs"),

0 commit comments

Comments
 (0)