diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2018-11-08 18:14:49 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-08 18:14:49 -0700 |
| commit | 78cab361394c6cdb9ab950ff094bcc5e0635ce86 (patch) | |
| tree | a8277b2651ce2045713d109115784658559c5297 /src/test/codegen | |
| parent | 6153ce127aaed3fcef119a86762879c711bdc96c (diff) | |
| parent | 463ad9098e12d1fbcfec2125d0ebfc6467866e38 (diff) | |
| download | rust-78cab361394c6cdb9ab950ff094bcc5e0635ce86.tar.gz rust-78cab361394c6cdb9ab950ff094bcc5e0635ce86.zip | |
Rollup merge of #55633 - nikic:memcpy-align, r=nagisa
Support memcpy/memmove with differing src/dst alignment If LLVM 7 is used, generate memcpy/memmove with differing src/dst alignment. I've added new FFI functions to construct these through the builder API, which is more convenient than dealing with differing intrinsic signatures depending on the LLVM version. Fixes #49740.
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/packed.rs | 4 | ||||
| -rw-r--r-- | src/test/codegen/stores.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/test/codegen/packed.rs b/src/test/codegen/packed.rs index 10dd12909b6..b50f5b6f16f 100644 --- a/src/test/codegen/packed.rs +++ b/src/test/codegen/packed.rs @@ -65,7 +65,7 @@ pub struct BigPacked2 { pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca %Array // CHECK: call void %{{.*}}(%Array* noalias nocapture sret dereferenceable(32) [[ALLOCA]]) -// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 %{{.*}}, i8* align 1 %{{.*}}, i{{[0-9]+}} 32, i1 false) +// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 %{{.*}}, i8* align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) // check that calls whose destination is a field of a packed struct // go through an alloca rather than calling the function with an // unaligned destination. @@ -77,7 +77,7 @@ pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { pub fn call_pkd2(f: fn() -> Array) -> BigPacked2 { // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca %Array // CHECK: call void %{{.*}}(%Array* noalias nocapture sret dereferenceable(32) [[ALLOCA]]) -// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 2 %{{.*}}, i8* align 2 %{{.*}}, i{{[0-9]+}} 32, i1 false) +// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 2 %{{.*}}, i8* align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) // check that calls whose destination is a field of a packed struct // go through an alloca rather than calling the function with an // unaligned destination. diff --git a/src/test/codegen/stores.rs b/src/test/codegen/stores.rs index 0aaf00bfdbe..871bee13b19 100644 --- a/src/test/codegen/stores.rs +++ b/src/test/codegen/stores.rs @@ -31,7 +31,7 @@ pub fn small_array_alignment(x: &mut [i8; 4], y: [i8; 4]) { // CHECK: store i32 %0, 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* align 1 [[Y8]], i8* align 1 [[TMP8]], i{{[0-9]+}} 4, i1 false) +// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 [[Y8]], i8* align 4 [[TMP8]], i{{[0-9]+}} 4, i1 false) *x = y; } @@ -45,6 +45,6 @@ pub fn small_struct_alignment(x: &mut Bytes, y: Bytes) { // CHECK: store i32 %0, 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* align 1 [[Y8]], i8* align 1 [[TMP8]], i{{[0-9]+}} 4, i1 false) +// CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 [[Y8]], i8* align 4 [[TMP8]], i{{[0-9]+}} 4, i1 false) *x = y; } |
