3 // Once we're done with llvm 14 and earlier, this test can be deleted.
7 use std::mem::MaybeUninit;
9 // Boxing a `MaybeUninit` value should not copy junk from the stack
11 pub fn box_uninitialized() -> Box<MaybeUninit<usize>> {
12 // CHECK-LABEL: @box_uninitialized
17 Box::new(MaybeUninit::uninit())
20 // https://github.com/rust-lang/rust/issues/58201
22 pub fn box_uninitialized2() -> Box<MaybeUninit<[usize; 1024 * 1024]>> {
23 // CHECK-LABEL: @box_uninitialized2
28 Box::new(MaybeUninit::uninit())
31 // Hide the LLVM 15+ `allocalign` attribute in the declaration of __rust_alloc
32 // from the CHECK-NOT above. We don't check the attributes here because we can't rely
33 // on all of them being set until LLVM 15.
34 // CHECK: declare noalias{{.*}} @__rust_alloc(i{{[0-9]+}} noundef, i{{[0-9]+.*}} noundef)