From f8d5d0c30c32c20163e45c3c1521add198b63afc Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Tue, 3 Oct 2017 10:45:07 +0300 Subject: rustc_trans: compute better align/dereferenceable attributes from pointees. --- src/test/codegen/function-arguments.rs | 10 +++++----- src/test/codegen/packed.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/test/codegen') diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index 05682a8efae..6cb1972afa5 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -15,7 +15,7 @@ #![feature(custom_attribute)] pub struct S { - _field: [i64; 4], + _field: [i32; 8], } pub struct UnsafeInner { @@ -66,7 +66,7 @@ pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) { pub fn mutable_borrow(_: &mut i32) { } -// CHECK: @indirect_struct(%S* noalias nocapture dereferenceable(32) %arg0) +// CHECK: @indirect_struct(%S* noalias nocapture align 4 dereferenceable(32) %arg0) #[no_mangle] pub fn indirect_struct(_: S) { } @@ -77,17 +77,17 @@ pub fn indirect_struct(_: S) { pub fn borrowed_struct(_: &S) { } -// CHECK: noalias dereferenceable(4) i32* @_box(i32* noalias dereferenceable(4) %x) +// CHECK: noalias align 4 dereferenceable(4) i32* @_box(i32* noalias dereferenceable(4) %x) #[no_mangle] pub fn _box(x: Box) -> Box { x } -// CHECK: @struct_return(%S* noalias nocapture sret dereferenceable(32)) +// CHECK: @struct_return(%S* noalias nocapture sret align 4 dereferenceable(32)) #[no_mangle] pub fn struct_return() -> S { S { - _field: [0, 0, 0, 0] + _field: [0, 0, 0, 0, 0, 0, 0, 0] } } diff --git a/src/test/codegen/packed.rs b/src/test/codegen/packed.rs index 99e6e38a3bf..87cf042f27e 100644 --- a/src/test/codegen/packed.rs +++ b/src/test/codegen/packed.rs @@ -39,7 +39,7 @@ pub struct BigPacked { #[no_mangle] pub fn call_pkd(f: fn() -> Array) -> BigPacked { // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca %Array -// CHECK: call void %{{.*}}(%Array* noalias nocapture sret dereferenceable(32) [[ALLOCA]]) +// CHECK: call void %{{.*}}(%Array* noalias nocapture sret align 4 dereferenceable(32) [[ALLOCA]]) // CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 32, i32 1, 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 -- cgit 1.4.1-3-g733a5