diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2022-12-02 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2022-12-03 01:04:42 +0100 |
| commit | b740cdcf43f6d686f52d3f85100a0ff5ff0c043d (patch) | |
| tree | 2061c143decbf92494365d20a914e0ab41d21137 /compiler/rustc_codegen_llvm/src/attributes.rs | |
| parent | c955add18c88427eaf09ec2086e3f8a9ccd30021 (diff) | |
| download | rust-b740cdcf43f6d686f52d3f85100a0ff5ff0c043d.tar.gz rust-b740cdcf43f6d686f52d3f85100a0ff5ff0c043d.zip | |
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.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 13 |
1 files changed, 6 insertions, 7 deletions
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: |
