1 // compile-flags: -C no-prepopulate-passes
6 // Hack to get the correct size for the length part in slices
7 // CHECK: @helper([[USIZE:i[0-9]+]] %_1)
9 pub fn helper(_: usize) {
12 // Check that we correctly generate a GEP for a ZST that is not included in Scalar layout
13 // CHECK-LABEL: @scalar_layout
15 pub fn scalar_layout(s: &(u64, ())) {
16 // CHECK: [[X0:%[0-9]+]] = bitcast i64* %s to i8*
17 // CHECK-NEXT: [[X1:%[0-9]+]] = getelementptr i8, i8* [[X0]], [[USIZE]] 8
19 &x; // keep variable in an alloca
22 // Check that we correctly generate a GEP for a ZST that is not included in ScalarPair layout
23 // CHECK-LABEL: @scalarpair_layout
25 pub fn scalarpair_layout(s: &(u64, u32, ())) {
26 // CHECK: [[X0:%[0-9]+]] = bitcast { i64, i32 }* %s to i8*
27 // CHECK-NEXT: [[X1:%[0-9]+]] = getelementptr i8, i8* [[X0]], [[USIZE]] 12
29 &x; // keep variable in an alloca
33 pub struct U64x4(u64, u64, u64, u64);
35 // Check that we correctly generate a GEP for a ZST that is not included in Vector layout
36 // CHECK-LABEL: @vector_layout
38 pub fn vector_layout(s: &(U64x4, ())) {
39 // CHECK: [[X0:%[0-9]+]] = bitcast <4 x i64>* %s to i8*
40 // CHECK-NEXT: [[X1:%[0-9]+]] = getelementptr i8, i8* [[X0]], [[USIZE]] 32
42 &x; // keep variable in an alloca