diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2025-07-17 21:47:00 +0100 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2025-08-20 17:08:46 +0100 |
| commit | 8ea3b093819aabd92a605b42989341da0c97c0d6 (patch) | |
| tree | 3316419d585c84e5ee1fd20df3fb904f9e69d4bd /compiler/rustc_codegen_llvm | |
| parent | 1c9952f4dd6e0947ee91f07130c03813a088a894 (diff) | |
| download | rust-8ea3b093819aabd92a605b42989341da0c97c0d6.tar.gz rust-8ea3b093819aabd92a605b42989341da0c97c0d6.zip | |
Pass `alloc-variant-zeroed` to LLVM
Diffstat (limited to 'compiler/rustc_codegen_llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index c548f467583..984db43c67f 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -436,6 +436,16 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>( || codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR_ZEROED) { to_add.push(create_alloc_family_attr(cx.llcx)); + if let Some(zv) = + cx.tcx.get_attr(instance.def_id(), rustc_span::sym::rustc_allocator_zeroed_variant) + && let Some(name) = zv.value_str() + { + to_add.push(llvm::CreateAttrStringValue( + cx.llcx, + "alloc-variant-zeroed", + &mangle_internal_symbol(cx.tcx, name.as_str()), + )); + } // apply to argument place instead of function let alloc_align = AttributeKind::AllocAlign.create_attr(cx.llcx); attributes::apply_to_llfn(llfn, AttributePlace::Argument(1), &[alloc_align]); |
