Skip to content

Commit

Permalink
Never inline cold functions
Browse files Browse the repository at this point in the history
The information about cold attribute is lost during inlining,
Avoid the issue by never inlining cold functions.
  • Loading branch information
tmiasko committed Nov 12, 2020
1 parent 0b4af16 commit ae43326
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_mir/src/transform/inline.rs
Expand Up @@ -252,9 +252,9 @@ impl Inliner<'tcx> {
self.tcx.sess.opts.debugging_opts.inline_mir_threshold
};

// Significantly lower the threshold for inlining cold functions
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) {
threshold /= 5;
debug!("#[cold] present - not inlining");
return false;
}

// Give a bonus functions with a small number of blocks,
Expand Down

0 comments on commit ae43326

Please sign in to comment.