From dce14cfacc232e80dbed68430183085fd39dea02 Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Mon, 21 Feb 2022 14:47:56 -0500 Subject: Remove LLVM attribute removal This was necessary before, because `declare_raw_fn` would always apply the default optimization attributes to every declared function, and then `attributes::from_fn_attrs` would have to remove the default attributes in the case of, e.g. `#[optimize(speed)]` in a `-Os` build. However, every relevant callsite of `declare_raw_fn` (i.e. where we actually generate code for the function, and not e.g. a call to an intrinsic, where optimization attributes don't [?] matter) calls `from_fn_attrs`, so we can simply remove the attribute setting from `declare_raw_fn`, and rely on `from_fn_attrs` to apply the correct attributes all at once. --- compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 6 ------ compiler/rustc_codegen_llvm/src/llvm/mod.rs | 6 ------ 2 files changed, 12 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src/llvm') diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 31d1460e178..b72c06158c7 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -1201,12 +1201,6 @@ extern "C" { Attrs: *const &'a Attribute, AttrsLen: size_t, ); - pub fn LLVMRustRemoveFunctionAttributes( - Fn: &Value, - index: c_uint, - Attrs: *const AttributeKind, - AttrsLen: size_t, - ); // Operations on parameters pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>; diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs index 1c1c4e0a159..4892b8d4a84 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs @@ -37,12 +37,6 @@ pub fn AddFunctionAttributes<'ll>(llfn: &'ll Value, idx: AttributePlace, attrs: } } -pub fn RemoveFunctionAttributes(llfn: &Value, idx: AttributePlace, attrs: &[AttributeKind]) { - unsafe { - LLVMRustRemoveFunctionAttributes(llfn, idx.as_uint(), attrs.as_ptr(), attrs.len()); - } -} - pub fn AddCallSiteAttributes<'ll>( callsite: &'ll Value, idx: AttributePlace, -- cgit 1.4.1-3-g733a5