]> git.lizzy.rs Git - rust.git/commitdiff
Add a regression test for argument copies with DestinationPropagation
authorBen Kimock <kimockb@gmail.com>
Tue, 10 Jan 2023 01:56:38 +0000 (20:56 -0500)
committerBen Kimock <kimockb@gmail.com>
Wed, 11 Jan 2023 15:27:06 +0000 (10:27 -0500)
tests/codegen/move-operands.rs [new file with mode: 0644]

diff --git a/tests/codegen/move-operands.rs b/tests/codegen/move-operands.rs
new file mode 100644 (file)
index 0000000..6c51324
--- /dev/null
@@ -0,0 +1,12 @@
+// compile-flags: -C no-prepopulate-passes -Zmir-enable-passes=+DestinationPropagation
+
+#![crate_type = "lib"]
+
+type T = [u8; 256];
+
+#[no_mangle]
+pub fn f(a: T, b: fn(_: T, _: T)) {
+    // CHECK: call void @llvm.memcpy.{{.*}}({{i8\*|ptr}} align 1 %{{.*}}, {{i8\*|ptr}} align 1 %{{.*}}, {{.*}} 256, i1 false)
+    // CHECK-NOT: call void @llvm.memcpy.{{.*}}({{i8\*|ptr}} align 1 %{{.*}}, {{i8\*|ptr}} align 1 %{{.*}}, {{.*}} 256, i1 false)
+    b(a, a)
+}