@@ -15,9 +15,14 @@ pub struct NonNull3 {
15
15
ptr : * const ( ) ,
16
16
}
17
17
18
+ trait Foo { }
19
+
20
+ #[ rustc_layout_scalar_valid_range_start( 1 ) ]
21
+ pub struct NonNull4 ( * const dyn Foo ) ;
22
+
18
23
// CHECK: define void @test_nonnull_load
19
24
#[ no_mangle]
20
- pub fn test_nonnull_load ( p1 : & NonNull1 , p2 : & NonNull2 , p3 : & NonNull3 ) {
25
+ pub fn test_nonnull_load ( p1 : & NonNull1 , p2 : & NonNull2 , p3 : & NonNull3 , p4 : & NonNull4 ) {
21
26
// CHECK: %[[P1:[0-9]+]] = bitcast i8** %p1 to {}**
22
27
// CHECK: load {}*, {}** %[[P1]], align 8, !nonnull
23
28
std:: hint:: black_box ( p1. 0 ) ;
@@ -29,6 +34,13 @@ pub fn test_nonnull_load(p1: &NonNull1, p2: &NonNull2, p3: &NonNull3) {
29
34
// CHECK: %[[P3:[0-9]+]] = bitcast i8** %p3 to {}**
30
35
// CHECK: load {}*, {}** %[[P3]], align 8, !nonnull
31
36
std:: hint:: black_box ( p3. ptr ) ;
37
+
38
+ // CHECK: %[[P4_PTR:[0-9]+]] = bitcast { i8*, i64* }* %p4 to {}**
39
+ // CHECK: load {}*, {}** %[[P4_PTR]], align 8, !nonnull
40
+ // CHECK: %[[P4_VTABLE:[0-9]+]] = getelementptr inbounds { i8*, i64* }, { i8*, i64* }* %p4, i64 0, i32 1
41
+ // CHECK: %[[P4_VTABLE_PTR:[0-9]+]] = bitcast i64** %[[P4_VTABLE]] to [3 x i64]**
42
+ // CHECK: load [3 x i64]*, [3 x i64]** %[[P4_VTABLE_PTR]], align 8, !nonnull
43
+ std:: hint:: black_box ( p4. 0 ) ;
32
44
}
33
45
34
46
#[ rustc_layout_scalar_valid_range_start( 16 ) ]
0 commit comments