Auto merge of #94229 - erikdesjardins:rem2, r=nikic
Remove LLVM attribute removal
This was necessary before, because `declare_raw_fn` would always apply
the default optimization attributes to every declared function.
Then `attributes::from_fn_attrs` would have to remove the default
attributes in the case of, e.g. `#[optimize(speed)]` in a `-Os` build.
(see [`src/test/codegen/optimize-attr-1.rs`](03a8cc7df1/src/test/codegen/optimize-attr-1.rs (L33)
))
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 remove the attribute setting
from `declare_raw_fn`, and rely on `from_fn_attrs` to apply the correct
attributes all at once.
r? `@ghost` (blocked on #94221)
`@rustbot` label S-blocked
This commit is contained in:
commit
c42d846add
5 changed files with 13 additions and 87 deletions
|
@ -1202,12 +1202,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>;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue