Never inline cold functions

The information about cold attribute is lost during inlining,
Avoid the issue by never inlining cold functions.
This commit is contained in:
Tomasz Miąsko 2020-11-11 00:00:00 +00:00
parent 0b4af1614d
commit ae4332643d

View File

@ -252,9 +252,9 @@ fn should_inline(&self, callsite: CallSite<'tcx>, callee_body: &Body<'tcx>) -> b
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,