Skip to content

Commit aa7859c

Browse files
committed
Auto merge of #147030 - nikic:revert-alloc-zeroed, r=wesleywiser
Revert "Auto merge of #144086 - clubby789:alloc-zeroed, r=nikic" This reverts commit 040a98a, reversing changes made to e8a792d. This reverts #144086 on beta due to #145995. On master the issue will be fixed by #146766.
2 parents bb624dc + 186d91d commit aa7859c

File tree

5 files changed

+0
-36
lines changed

5 files changed

+0
-36
lines changed

compiler/rustc_codegen_llvm/src/attributes.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,6 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
435435
|| codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR_ZEROED)
436436
{
437437
to_add.push(create_alloc_family_attr(cx.llcx));
438-
if let Some(zv) =
439-
cx.tcx.get_attr(instance.def_id(), rustc_span::sym::rustc_allocator_zeroed_variant)
440-
&& let Some(name) = zv.value_str()
441-
{
442-
to_add.push(llvm::CreateAttrStringValue(
443-
cx.llcx,
444-
"alloc-variant-zeroed",
445-
&mangle_internal_symbol(cx.tcx, name.as_str()),
446-
));
447-
}
448438
// apply to argument place instead of function
449439
let alloc_align = AttributeKind::AllocAlign.create_attr(cx.llcx);
450440
attributes::apply_to_llfn(llfn, AttributePlace::Argument(1), &[alloc_align]);

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,10 +1001,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
10011001
rustc_allocator_zeroed, Normal, template!(Word), WarnFollowing,
10021002
EncodeCrossCrate::No,
10031003
),
1004-
rustc_attr!(
1005-
rustc_allocator_zeroed_variant, Normal, template!(NameValueStr: "function"), ErrorPreceding,
1006-
EncodeCrossCrate::Yes,
1007-
),
10081004
gated!(
10091005
default_lib_allocator, Normal, template!(Word), WarnFollowing,
10101006
EncodeCrossCrate::No, allocator_internals, experimental!(default_lib_allocator),

compiler/rustc_span/src/symbol.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,6 @@ symbols! {
18501850
rustc_align_static,
18511851
rustc_allocator,
18521852
rustc_allocator_zeroed,
1853-
rustc_allocator_zeroed_variant,
18541853
rustc_allow_const_fn_unstable,
18551854
rustc_allow_incoherent_impl,
18561855
rustc_allowed_through_unstable_modules,

library/alloc/src/alloc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ unsafe extern "Rust" {
1717
#[rustc_allocator]
1818
#[rustc_nounwind]
1919
#[rustc_std_internal_symbol]
20-
#[rustc_allocator_zeroed_variant = "__rust_alloc_zeroed"]
2120
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
2221
#[rustc_deallocator]
2322
#[rustc_nounwind]

tests/codegen-llvm/vec-calloc.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//@ revisions: normal llvm21
21
//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
3-
//@ [llvm21] min-llvm-version: 21
42
//@ only-x86_64
53

64
#![crate_type = "lib"]
@@ -178,24 +176,6 @@ pub fn vec_option_i32(n: usize) -> Vec<Option<i32>> {
178176
vec![None; n]
179177
}
180178

181-
// LLVM21-LABEL: @vec_array
182-
#[cfg(llvm21)]
183-
#[no_mangle]
184-
pub fn vec_array(n: usize) -> Vec<[u32; 1_000_000]> {
185-
// LLVM21-NOT: call {{.*}}alloc::vec::from_elem
186-
// LLVM21-NOT: call {{.*}}reserve
187-
// LLVM21-NOT: call {{.*}}__rust_alloc(
188-
189-
// LLVM21: call {{.*}}__rust_alloc_zeroed(
190-
191-
// LLVM21-NOT: call {{.*}}alloc::vec::from_elem
192-
// LLVM21-NOT: call {{.*}}reserve
193-
// LLVM21-NOT: call {{.*}}__rust_alloc(
194-
195-
// LLVM21: ret void
196-
vec![[0; 1_000_000]; 3]
197-
}
198-
199179
// Ensure that __rust_alloc_zeroed gets the right attributes for LLVM to optimize it away.
200180
// CHECK: declare noalias noundef ptr @{{.*}}__rust_alloc_zeroed(i64 noundef, i64 allocalign noundef) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]]
201181

0 commit comments

Comments
 (0)