Skip to content

Commit

Permalink
just put smallvec lengths in the signature
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdesjardins committed Feb 26, 2022
1 parent 30d3ce0 commit 91e7e8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_codegen_llvm/src/abi.rs
Expand Up @@ -51,13 +51,10 @@ const OPTIMIZATION_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 5] = [
(ArgAttribute::NoUndef, llvm::AttributeKind::NoUndef),
];

fn get_attrs<'ll>(
this: &ArgAttributes,
cx: &CodegenCx<'ll, '_>,
) -> SmallVec<impl smallvec::Array<Item = &'ll Attribute>> {
fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attribute; 8]> {
let mut regular = this.regular;

let mut attrs = SmallVec::<[_; 8]>::new();
let mut attrs = SmallVec::new();

// ABI-affecting attributes must always be applied
for (attr, llattr) in ABI_AFFECTING_ATTRIBUTES {
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_llvm/src/attributes.rs
Expand Up @@ -62,8 +62,8 @@ fn inline_attr<'ll>(cx: &CodegenCx<'ll, '_>, inline: InlineAttr) -> Option<&'ll
pub fn sanitize_attrs<'ll>(
cx: &CodegenCx<'ll, '_>,
no_sanitize: SanitizerSet,
) -> SmallVec<impl smallvec::Array<Item = &'ll Attribute>> {
let mut attrs = SmallVec::<[_; 4]>::new();
) -> SmallVec<[&'ll Attribute; 4]> {
let mut attrs = SmallVec::new();
let enabled = cx.tcx.sess.opts.debugging_opts.sanitizer - no_sanitize;
if enabled.contains(SanitizerSet::ADDRESS) {
attrs.push(llvm::AttributeKind::SanitizeAddress.create_attr(cx.llcx));
Expand Down Expand Up @@ -224,12 +224,12 @@ pub(crate) fn default_optimisation_attrs<'ll>(
cx: &CodegenCx<'ll, '_>,
) -> (
// Attributes to remove
SmallVec<impl smallvec::Array<Item = AttributeKind>>,
SmallVec<[AttributeKind; 3]>,
// Attributes to add
SmallVec<impl smallvec::Array<Item = &'ll Attribute>>,
SmallVec<[&'ll Attribute; 2]>,
) {
let mut to_remove = SmallVec::<[_; 3]>::new();
let mut to_add = SmallVec::<[_; 2]>::new();
let mut to_remove = SmallVec::new();
let mut to_add = SmallVec::new();
match cx.sess().opts.optimize {
OptLevel::Size => {
to_remove.push(llvm::AttributeKind::MinSize);
Expand Down

0 comments on commit 91e7e8d

Please sign in to comment.