Auto merge of #79192 - tmiasko:naked-noinline, r=oli-obk

Never inline naked functions

The `#[naked]` attribute disabled prologue / epilogue emission for the
function and it is responsibility of a developer to provide them. The
compiler is no position to inline such functions correctly.

Disable inlining of naked functions at LLVM and MIR level.

Closes #60919.
This commit is contained in:
bors 2020-11-20 06:01:49 +00:00
commit 5c45969502
4 changed files with 45 additions and 4 deletions

View file

@ -254,6 +254,11 @@ impl Inliner<'tcx> {
self.tcx.sess.opts.debugging_opts.inline_mir_threshold
};
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) {
debug!("#[naked] present - not inlining");
return false;
}
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) {
debug!("#[cold] present - not inlining");
return false;