1
Fork 0

Add -Zcross-crate-inline-threshold=yes

This commit is contained in:
Ben Kimock 2023-11-06 19:55:05 -05:00
parent aea82b268a
commit fcdd99edca
10 changed files with 161 additions and 13 deletions

View file

@ -3161,10 +3161,10 @@ impl PpMode {
pub(crate) mod dep_tracking {
use super::{
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, DebugInfoCompression,
ErrorOutputType, InstrumentCoverage, InstrumentXRay, LinkerPluginLto, LocationDetail,
LtoCli, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes, Polonius,
RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm, SplitDwarfKind,
SwitchWithOptPath, SymbolManglingVersion, TraitSolver, TrimmedDefPaths,
ErrorOutputType, InliningThreshold, InstrumentCoverage, InstrumentXRay, LinkerPluginLto,
LocationDetail, LtoCli, OomStrategy, OptLevel, OutFileName, OutputType, OutputTypes,
Polonius, RemapPathScopeComponents, ResolveDocLinks, SourceFileHashAlgorithm,
SplitDwarfKind, SwitchWithOptPath, SymbolManglingVersion, TraitSolver, TrimmedDefPaths,
};
use crate::lint;
use crate::options::WasiExecModel;
@ -3270,6 +3270,7 @@ pub(crate) mod dep_tracking {
LanguageIdentifier,
TraitSolver,
Polonius,
InliningThreshold,
);
impl<T1, T2> DepTrackingHash for (T1, T2)
@ -3435,3 +3436,16 @@ impl Polonius {
matches!(self, Polonius::Next)
}
}
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
pub enum InliningThreshold {
Always,
Sometimes(usize),
Never,
}
impl Default for InliningThreshold {
fn default() -> Self {
Self::Sometimes(100)
}
}

View file

@ -428,6 +428,8 @@ mod desc {
"one of supported execution strategies (`same-thread`, or `cross-thread`)";
pub const parse_dump_solver_proof_tree: &str = "one of: `always`, `on-request`, `on-error`";
pub const parse_remap_path_scope: &str = "comma separated list of scopes: `macro`, `diagnostics`, `unsplit-debuginfo`, `split-debuginfo`, `split-debuginfo-path`, `object`, `all`";
pub const parse_inlining_threshold: &str =
"either a boolean (`yes`, `no`, `on`, `off`, etc), or a non-negative number";
}
mod parse {
@ -1310,6 +1312,26 @@ mod parse {
};
true
}
pub(crate) fn parse_inlining_threshold(slot: &mut InliningThreshold, v: Option<&str>) -> bool {
match v {
Some("always" | "yes") => {
*slot = InliningThreshold::Always;
}
Some("never") => {
*slot = InliningThreshold::Never;
}
Some(v) => {
if let Ok(threshold) = v.parse() {
*slot = InliningThreshold::Sometimes(threshold);
} else {
return false;
}
}
None => return false,
}
true
}
}
options! {
@ -1479,7 +1501,7 @@ options! {
"combine CGUs into a single one"),
crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
"inject the given attribute in the crate"),
cross_crate_inline_threshold: Option<usize> = (None, parse_opt_number, [TRACKED],
cross_crate_inline_threshold: InliningThreshold = (InliningThreshold::Sometimes(100), parse_inlining_threshold, [TRACKED],
"threshold to allow cross crate inlining of functions"),
debug_info_for_profiling: bool = (false, parse_bool, [TRACKED],
"emit discriminators and other data necessary for AutoFDO"),