@@ -23,25 +23,18 @@ pub struct Bytes {
23
23
// The array is stored as i32, but its alignment is lower, go with 1 byte to avoid target
24
24
// dependent alignment
25
25
#[ no_mangle]
26
- pub fn small_array_alignment ( x : & mut [ i8 ; 4 ] ) {
27
- // CHECK: [[VAR:%[0-9]+]] = load {{(\[4 x i8\]\*, )?}}[4 x i8]** %x
28
- // CHECK: [[VAR2:%[0-9]+]] = bitcast [4 x i8]* [[VAR]] to i32*
29
- // CHECK: store i32 %{{.*}}, i32* [[VAR2]], align 1
30
- * x = [ 0 ; 4 ] ;
26
+ pub fn small_array_alignment ( x : & mut [ i8 ; 4 ] , y : [ i8 ; 4 ] ) {
27
+ // CHECK: [[VAR:%[0-9]+]] = bitcast [4 x i8]* %y to i32*
28
+ // CHECK: store i32 %{{.*}}, i32* [[VAR]], align 1
29
+ * x = y;
31
30
}
32
31
33
32
// CHECK-LABEL: small_struct_alignment
34
33
// The struct is stored as i32, but its alignment is lower, go with 1 byte to avoid target
35
34
// dependent alignment
36
35
#[ no_mangle]
37
- pub fn small_struct_alignment ( x : & mut Bytes ) {
38
- // CHECK: [[VAR:%[0-9]+]] = load {{(%Bytes\*, )?}}%Bytes** %x
39
- // CHECK: [[VAR2:%[0-9]+]] = bitcast %Bytes* [[VAR]] to i32*
40
- // CHECK: store i32 %{{.*}}, i32* [[VAR2]], align 1
41
- * x = Bytes {
42
- a : 0 ,
43
- b : 0 ,
44
- c : 0 ,
45
- d : 0 ,
46
- } ;
36
+ pub fn small_struct_alignment ( x : & mut Bytes , y : Bytes ) {
37
+ // CHECK: [[VAR:%[0-9]+]] = bitcast %Bytes* %y to i32*
38
+ // CHECK: store i32 %{{.*}}, i32* [[VAR]], align 1
39
+ * x = y;
47
40
}
0 commit comments