From 13eec69e1c192afcac098c8c332a4cc9990b2c1c Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Mon, 9 Jan 2023 20:56:38 -0500 Subject: [PATCH] Add a regression test for argument copies with DestinationPropagation --- tests/codegen/move-operands.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/codegen/move-operands.rs 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) +}