]>
git.proxmox.com Git - rustc.git/blob - tests/codegen/zst-offset.rs
1 // compile-flags: -C no-prepopulate-passes -Copt-level=0
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: getelementptr i8, {{.+}}, [[USIZE]] 8
18 witness(&x
); // keep variable in an alloca
21 // Check that we correctly generate a GEP for a ZST that is not included in ScalarPair layout
22 // CHECK-LABEL: @scalarpair_layout
24 pub fn scalarpair_layout(s
: &(u64, u32, ())) {
25 // CHECK: getelementptr i8, {{.+}}, [[USIZE]] 12
27 witness(&x
); // keep variable in an alloca
31 pub struct U64x4(u64, u64, u64, u64);
33 // Check that we correctly generate a GEP for a ZST that is not included in Vector layout
34 // CHECK-LABEL: @vector_layout
36 pub fn vector_layout(s
: &(U64x4
, ())) {
37 // CHECK: getelementptr i8, {{.+}}, [[USIZE]] 32
39 witness(&x
); // keep variable in an alloca
43 fn witness(_
: &impl Sized
) {}