From b94a29a25ff9ca4a8edfc0b6c7d1d309dc03d5cd Mon Sep 17 00:00:00 2001 From: clubby789 Date: Tue, 17 Jan 2023 15:42:53 +0000 Subject: Implement `alloc::vec::IsZero` for `Option<$NUM>` types --- tests/codegen/vec-calloc.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/codegen/vec-calloc.rs') diff --git a/tests/codegen/vec-calloc.rs b/tests/codegen/vec-calloc.rs index ae6e448f172..9cc5bd4fd1a 100644 --- a/tests/codegen/vec-calloc.rs +++ b/tests/codegen/vec-calloc.rs @@ -161,6 +161,23 @@ pub fn vec_option_bool(n: usize) -> Vec> { vec![Some(false); n] } +// CHECK-LABEL: @vec_option_i32 +#[no_mangle] +pub fn vec_option_i32(n: usize) -> Vec> { + // CHECK-NOT: call {{.*}}alloc::vec::from_elem + // CHECK-NOT: call {{.*}}reserve + // CHECK-NOT: call {{.*}}__rust_alloc( + + // CHECK: call {{.*}}__rust_alloc_zeroed( + + // CHECK-NOT: call {{.*}}alloc::vec::from_elem + // CHECK-NOT: call {{.*}}reserve + // CHECK-NOT: call {{.*}}__rust_alloc( + + // CHECK: ret void + vec![None; n] +} + // Ensure that __rust_alloc_zeroed gets the right attributes for LLVM to optimize it away. // CHECK: declare noalias ptr @__rust_alloc_zeroed(i64, i64 allocalign) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]] -- cgit 1.4.1-3-g733a5