From b740cdcf43f6d686f52d3f85100a0ff5ff0c043d Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Fri, 2 Dec 2022 00:00:00 +0000 Subject: Mark naked functions as never inline in codegen_fn_attrs Use code generation attributes to ensure that naked functions are never inline, replacing separate checks in MIR inliner and LLVM code generation. --- compiler/rustc_codegen_llvm/src/attributes.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src') diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index a8b47633519..f3bdacf6085 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -258,13 +258,12 @@ pub fn from_fn_attrs<'ll, 'tcx>( OptimizeAttr::Speed => {} } - let inline = if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) { - InlineAttr::Never - } else if codegen_fn_attrs.inline == InlineAttr::None && instance.def.requires_inline(cx.tcx) { - InlineAttr::Hint - } else { - codegen_fn_attrs.inline - }; + let inline = + if codegen_fn_attrs.inline == InlineAttr::None && instance.def.requires_inline(cx.tcx) { + InlineAttr::Hint + } else { + codegen_fn_attrs.inline + }; to_add.extend(inline_attr(cx, inline)); // The `uwtable` attribute according to LLVM is: -- cgit 1.4.1-3-g733a5