about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-11 19:56:44 +0000
committerbors <bors@rust-lang.org>2023-01-11 19:56:44 +0000
commit1e4f90061cc4bc566f99ab21b1f101182b10cf0c (patch)
tree3ca9bdf5d20f478cdb3fc5e1d4de8a37afe83f4b /tests
parentef4046e4f3932991971cdb64915172899532aece (diff)
parent13eec69e1c192afcac098c8c332a4cc9990b2c1c (diff)
downloadrust-1e4f90061cc4bc566f99ab21b1f101182b10cf0c.tar.gz
rust-1e4f90061cc4bc566f99ab21b1f101182b10cf0c.zip
Auto merge of #106660 - saethlin:destprop-move-codegen, r=tmiasko
Add a regression test for argument copies with DestinationPropagation

This example, as a codegen test: https://github.com/rust-lang/rust/pull/105813#issuecomment-1367947793

r? `@tmiasko`
Diffstat (limited to 'tests')
-rw-r--r--tests/codegen/move-operands.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/codegen/move-operands.rs b/tests/codegen/move-operands.rs
new file mode 100644
index 00000000000..6c51324a312
--- /dev/null
+++ b/tests/codegen/move-operands.rs
@@ -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)
+}