diff options
| author | bors <bors@rust-lang.org> | 2025-08-20 17:16:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-20 17:16:34 +0000 |
| commit | 040a98af70f0a7da03f3d5356531b28a2a7a77e4 (patch) | |
| tree | 85c77e585d40a6871b8f9552234f5c784dfca8f0 /compiler/rustc_codegen_llvm/src | |
| parent | e8a792daf500b5ff8097896ddb6cc037abe92487 (diff) | |
| parent | 8ea3b093819aabd92a605b42989341da0c97c0d6 (diff) | |
| download | rust-040a98af70f0a7da03f3d5356531b28a2a7a77e4.tar.gz rust-040a98af70f0a7da03f3d5356531b28a2a7a77e4.zip | |
Auto merge of #144086 - clubby789:alloc-zeroed, r=nikic
Pass `alloc-variant-zeroed` to LLVM Makes use of https://github.com/llvm/llvm-project/pull/138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires https://github.com/llvm/llvm-project/pull/149336 to work.~~ Closes rust-lang/rust#104847
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -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 8f1218bb505..5affb26483a 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -420,6 +420,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]); |
