File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ // compile-flags: -C no-prepopulate-passes
2
+
3
+ #![ crate_type = "lib" ]
4
+
5
+ // Hack to get the correct size for the length part in slices
6
+ // CHECK: @helper([[USIZE:i[0-9]+]] %_1)
7
+ #[ no_mangle]
8
+ pub fn helper ( _: usize ) {
9
+ }
10
+
11
+ // Check that we correctly generate a GEP for a ZST that is not included in Scalar layout
12
+ // CHECK-LABEL: @scalar_layout
13
+ #[ no_mangle]
14
+ pub fn scalar_layout ( s : & ( u64 , ( ) ) ) {
15
+ // CHECK: [[X0:%[0-9]+]] = bitcast i64* %s to i8*
16
+ // CHECK-NEXT: [[X1:%[0-9]+]] = getelementptr i8, i8* [[X0]], [[USIZE]] 8
17
+ let x = & s. 1 ;
18
+ & x; // keep variable in an alloca
19
+ }
20
+
21
+ // Check that we correctly generate a GEP for a ZST that is not included in ScalarPair layout
22
+ // CHECK-LABEL: @scalarpair_layout
23
+ #[ no_mangle]
24
+ pub fn scalarpair_layout ( s : & ( u64 , u32 , ( ) ) ) {
25
+ // CHECK: [[X0:%[0-9]+]] = bitcast { i64, i32 }* %s to i8*
26
+ // CHECK-NEXT: [[X1:%[0-9]+]] = getelementptr i8, i8* [[X0]], [[USIZE]] 12
27
+ let x = & s. 2 ;
28
+ & x; // keep variable in an alloca
29
+ }
You can’t perform that action at this time.
0 commit comments