diff options
| author | bors <bors@rust-lang.org> | 2016-06-07 14:45:39 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-06-07 14:45:39 -0700 |
| commit | ec872dc8a3f008299ca1508105ee064d1f0f0367 (patch) | |
| tree | a143dd587358cf577ae7465ce4d67e9505c02694 /src/test/codegen | |
| parent | 39a523ba134c86df449bccd903313fc5e7b6f6c3 (diff) | |
| parent | e252865b744568649c3ecfcf8ac02bb6f73d7fc6 (diff) | |
| download | rust-ec872dc8a3f008299ca1508105ee064d1f0f0367.tar.gz rust-ec872dc8a3f008299ca1508105ee064d1f0f0367.zip | |
Auto merge of #34141 - eddyb:trans-abi-memcpy, r=nikomatsakis
trans: always use a memcpy for ABI argument/return casts. When storing incoming arguments or values returned by call/invoke, always do a `memcpy` from a temporary of the cast type, if there is an ABI cast. While Clang has gotten smarter ([store](https://godbolt.org/g/EphFuK) vs [memcpy](https://godbolt.org/g/5dikH9)), a `memcpy` will always work. This is what @dotdash has wanted to do all along, and it fixes #32049.
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/stores.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/test/codegen/stores.rs b/src/test/codegen/stores.rs index 8c425507975..89bb5d93c74 100644 --- a/src/test/codegen/stores.rs +++ b/src/test/codegen/stores.rs @@ -26,8 +26,12 @@ pub struct Bytes { #[no_mangle] #[rustc_no_mir] // FIXME #27840 MIR has different codegen. pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) { -// CHECK: store i32 %{{.*}}, i32* %{{.*}}, align 1 -// CHECK: [[VAR:%[0-9]+]] = bitcast i32* %{{.*}} to [4 x i8]* +// CHECK: %y = alloca [4 x i8] +// CHECK: [[TMP:%.+]] = alloca i32 +// CHECK: store i32 %1, i32* [[TMP]] +// CHECK: [[Y8:%[0-9]+]] = bitcast [4 x i8]* %y to i8* +// CHECK: [[TMP8:%[0-9]+]] = bitcast i32* [[TMP]] to i8* +// CHECK: call void @llvm.memcpy.{{.*}}(i8* [[Y8]], i8* [[TMP8]], i{{[0-9]+}} 4, i32 1, i1 false) *x = y; } @@ -37,7 +41,11 @@ pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) { #[no_mangle] #[rustc_no_mir] // FIXME #27840 MIR has different codegen. pub fn small_struct_alignment(x: &mut Bytes, y: Bytes) { -// CHECK: store i32 %{{.*}}, i32* %{{.*}}, align 1 -// CHECK: [[VAR:%[0-9]+]] = bitcast i32* %{{.*}} to %Bytes* +// CHECK: %y = alloca %Bytes +// CHECK: [[TMP:%.+]] = alloca i32 +// CHECK: store i32 %1, i32* [[TMP]] +// CHECK: [[Y8:%[0-9]+]] = bitcast %Bytes* %y to i8* +// CHECK: [[TMP8:%[0-9]+]] = bitcast i32* [[TMP]] to i8* +// CHECK: call void @llvm.memcpy.{{.*}}(i8* [[Y8]], i8* [[TMP8]], i{{[0-9]+}} 4, i32 1, i1 false) *x = y; } |
