about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorThe Miri Conjob Bot <miri@cron.bot>2023-10-17 05:05:07 +0000
committerThe Miri Conjob Bot <miri@cron.bot>2023-10-17 05:05:07 +0000
commit2ca415c1c2fc7991027a1cfa332e305b4f27a0f8 (patch)
treea072b8ca50207f8ed55e085580de73b0e37802f3 /tests/codegen
parent8fa1b6aad2bd14fa2477daf8eeab69464e8878a5 (diff)
parenteccc9e66287d5fd141e458ae3ab25ac96a567972 (diff)
downloadrust-2ca415c1c2fc7991027a1cfa332e305b4f27a0f8.tar.gz
rust-2ca415c1c2fc7991027a1cfa332e305b4f27a0f8.zip
Merge from rustc
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/target-feature-inline-closure.rs4
-rw-r--r--tests/codegen/vec_pop_push_noop.rs24
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs
index d075706173f..54cb27242d5 100644
--- a/tests/codegen/target-feature-inline-closure.rs
+++ b/tests/codegen/target-feature-inline-closure.rs
@@ -31,3 +31,7 @@ unsafe fn without_avx(x: __m256) -> __m256 {
     };
     add(x, x)
 }
+
+// Don't allow the above CHECK-NOT to accidentally match a commit hash in the
+// compiler version.
+// CHECK-LABEL: rustc version
diff --git a/tests/codegen/vec_pop_push_noop.rs b/tests/codegen/vec_pop_push_noop.rs
new file mode 100644
index 00000000000..8bc7b68a816
--- /dev/null
+++ b/tests/codegen/vec_pop_push_noop.rs
@@ -0,0 +1,24 @@
+// compile-flags: -O
+
+#![crate_type = "lib"]
+
+#[no_mangle]
+// CHECK-LABEL: @noop(
+pub fn noop(v: &mut Vec<u8>) {
+    // CHECK-NOT: reserve_for_push
+    // CHECK-NOT: call
+    // CHECK: tail call void @llvm.assume
+    // CHECK-NOT: reserve_for_push
+    // CHECK-NOT: call
+    // CHECK: ret
+    if let Some(x) = v.pop() {
+        v.push(x)
+    }
+}
+
+#[no_mangle]
+// CHECK-LABEL: @push_byte(
+pub fn push_byte(v: &mut Vec<u8>) {
+    // CHECK: call {{.*}}reserve_for_push
+    v.push(3);
+}