summaryrefslogtreecommitdiffstats
path: root/tests/codegen/vec-calloc.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/codegen/vec-calloc.rs (renamed from src/test/codegen/vec-calloc.rs)19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/test/codegen/vec-calloc.rs b/tests/codegen/vec-calloc.rs
index ae6e448f1..4481a9d1e 100644
--- a/src/test/codegen/vec-calloc.rs
+++ b/tests/codegen/vec-calloc.rs
@@ -161,7 +161,24 @@ pub fn vec_option_bool(n: usize) -> Vec<Option<bool>> {
vec![Some(false); n]
}
+// CHECK-LABEL: @vec_option_i32
+#[no_mangle]
+pub fn vec_option_i32(n: usize) -> Vec<Option<i32>> {
+ // 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]+]]
+// CHECK: declare noalias noundef ptr @__rust_alloc_zeroed(i64 noundef, i64 allocalign noundef) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]]
// CHECK-DAG: attributes [[RUST_ALLOC_ZEROED_ATTRS]] = { {{.*}} allockind("alloc,zeroed,aligned") allocsize(0) uwtable "alloc-family"="__rust_alloc" {{.*}} }