about summary refs log tree commit diff
path: root/tests/codegen-llvm/vec-iter.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen-llvm/vec-iter.rs')
-rw-r--r--tests/codegen-llvm/vec-iter.rs58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/codegen-llvm/vec-iter.rs b/tests/codegen-llvm/vec-iter.rs
new file mode 100644
index 00000000000..4ed00d2d34f
--- /dev/null
+++ b/tests/codegen-llvm/vec-iter.rs
@@ -0,0 +1,58 @@
+//@ compile-flags: -Copt-level=3
+#![crate_type = "lib"]
+#![feature(exact_size_is_empty)]
+
+use std::vec;
+
+// CHECK-LABEL: @vec_iter_len_nonnull
+#[no_mangle]
+pub fn vec_iter_len_nonnull(it: &vec::IntoIter<u8>) -> usize {
+    // CHECK: load ptr
+    // CHECK-SAME: !nonnull
+    // CHECK-SAME: !noundef
+    // CHECK: load ptr
+    // CHECK-SAME: !nonnull
+    // CHECK-SAME: !noundef
+    // CHECK: sub nuw
+    // CHECK: ret
+    it.len()
+}
+
+// CHECK-LABEL: @vec_iter_is_empty_nonnull
+#[no_mangle]
+pub fn vec_iter_is_empty_nonnull(it: &vec::IntoIter<u8>) -> bool {
+    // CHECK: load ptr
+    // CHECK-SAME: !nonnull
+    // CHECK-SAME: !noundef
+    // CHECK: load ptr
+    // CHECK-SAME: !nonnull
+    // CHECK-SAME: !noundef
+    // CHECK: ret
+    it.is_empty()
+}
+
+// CHECK-LABEL: @vec_iter_next_nonnull
+#[no_mangle]
+pub fn vec_iter_next_nonnull(it: &mut vec::IntoIter<u8>) -> Option<u8> {
+    // CHECK: load ptr
+    // CHECK-SAME: !nonnull
+    // CHECK-SAME: !noundef
+    // CHECK: load ptr
+    // CHECK-SAME: !nonnull
+    // CHECK-SAME: !noundef
+    // CHECK: ret
+    it.next()
+}
+
+// CHECK-LABEL: @vec_iter_next_back_nonnull
+#[no_mangle]
+pub fn vec_iter_next_back_nonnull(it: &mut vec::IntoIter<u8>) -> Option<u8> {
+    // CHECK: load ptr
+    // CHECK-SAME: !nonnull
+    // CHECK-SAME: !noundef
+    // CHECK: load ptr
+    // CHECK-SAME: !nonnull
+    // CHECK-SAME: !noundef
+    // CHECK: ret
+    it.next_back()
+}