Skip to content

Commit ae43326

Browse files
committed
Never inline cold functions
The information about cold attribute is lost during inlining, Avoid the issue by never inlining cold functions.
1 parent 0b4af16 commit ae43326

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_mir/src/transform/inline.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ impl Inliner<'tcx> {
252252
self.tcx.sess.opts.debugging_opts.inline_mir_threshold
253253
};
254254

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

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

0 commit comments

Comments
 (0)