3
3
#![ crate_type = "lib" ]
4
4
#![ feature( rustc_attrs) ]
5
5
6
+ use std:: mem:: MaybeUninit ;
7
+
6
8
pub struct S {
7
9
_field : [ i32 ; 8 ] ,
8
10
}
@@ -11,68 +13,79 @@ pub struct UnsafeInner {
11
13
_field : std:: cell:: UnsafeCell < i16 > ,
12
14
}
13
15
14
- // CHECK: zeroext i1 @boolean(i1 zeroext %x)
16
+ // CHECK: noundef zeroext i1 @boolean(i1 noundef zeroext %x)
15
17
#[ no_mangle]
16
18
pub fn boolean ( x : bool ) -> bool {
17
19
x
18
20
}
19
21
20
- // CHECK: @readonly_borrow(i32* noalias readonly align 4 dereferenceable(4) %_1)
22
+ // CHECK: i8 @maybeuninit_boolean(i8 %x)
23
+ #[ no_mangle]
24
+ pub fn maybeuninit_boolean ( x : MaybeUninit < bool > ) -> MaybeUninit < bool > {
25
+ x
26
+ }
27
+
28
+ // CHECK: @readonly_borrow(i32* noalias noundef readonly align 4 dereferenceable(4) %_1)
21
29
// FIXME #25759 This should also have `nocapture`
22
30
#[ no_mangle]
23
31
pub fn readonly_borrow ( _: & i32 ) {
24
32
}
25
33
26
- // CHECK: @static_borrow(i32* noalias readonly align 4 dereferenceable(4) %_1)
34
+ // CHECK: @static_borrow(i32* noalias noundef readonly align 4 dereferenceable(4) %_1)
27
35
// static borrow may be captured
28
36
#[ no_mangle]
29
37
pub fn static_borrow ( _: & ' static i32 ) {
30
38
}
31
39
32
- // CHECK: @named_borrow(i32* noalias readonly align 4 dereferenceable(4) %_1)
40
+ // CHECK: @named_borrow(i32* noalias noundef readonly align 4 dereferenceable(4) %_1)
33
41
// borrow with named lifetime may be captured
34
42
#[ no_mangle]
35
43
pub fn named_borrow < ' r > ( _: & ' r i32 ) {
36
44
}
37
45
38
- // CHECK: @unsafe_borrow(i16* align 2 dereferenceable(2) %_1)
46
+ // CHECK: @unsafe_borrow(i16* noundef align 2 dereferenceable(2) %_1)
39
47
// unsafe interior means this isn't actually readonly and there may be aliases ...
40
48
#[ no_mangle]
41
49
pub fn unsafe_borrow ( _: & UnsafeInner ) {
42
50
}
43
51
44
- // CHECK: @mutable_unsafe_borrow(i16* noalias align 2 dereferenceable(2) %_1)
52
+ // CHECK: @mutable_unsafe_borrow(i16* noalias noundef align 2 dereferenceable(2) %_1)
45
53
// ... unless this is a mutable borrow, those never alias
46
54
#[ no_mangle]
47
55
pub fn mutable_unsafe_borrow ( _: & mut UnsafeInner ) {
48
56
}
49
57
50
- // CHECK: @mutable_borrow(i32* noalias align 4 dereferenceable(4) %_1)
58
+ // CHECK: @mutable_borrow(i32* noalias noundef align 4 dereferenceable(4) %_1)
51
59
// FIXME #25759 This should also have `nocapture`
52
60
#[ no_mangle]
53
61
pub fn mutable_borrow ( _: & mut i32 ) {
54
62
}
55
63
56
- // CHECK: @indirect_struct(%S* noalias nocapture dereferenceable(32) %_1)
64
+ // CHECK: @indirect_struct(%S* noalias nocapture noundef dereferenceable(32) %_1)
57
65
#[ no_mangle]
58
66
pub fn indirect_struct ( _: S ) {
59
67
}
60
68
61
- // CHECK: @borrowed_struct(%S* noalias readonly align 4 dereferenceable(32) %_1)
69
+ // CHECK: @borrowed_struct(%S* noalias noundef readonly align 4 dereferenceable(32) %_1)
62
70
// FIXME #25759 This should also have `nocapture`
63
71
#[ no_mangle]
64
72
pub fn borrowed_struct ( _: & S ) {
65
73
}
66
74
75
+ // CHECK: @raw_struct(%S* %_1)
76
+ #[ no_mangle]
77
+ pub fn raw_struct ( _: * const S ) {
78
+ }
79
+
67
80
// `Box` can get deallocated during execution of the function, so it should
68
81
// not get `dereferenceable`.
69
- // CHECK: noalias nonnull align 4 i32* @_box(i32* noalias nonnull align 4 %x)
82
+ // CHECK: noalias noundef nonnull align 4 i32* @_box(i32* noalias noundef nonnull align 4 %x)
70
83
#[ no_mangle]
71
84
pub fn _box ( x : Box < i32 > ) -> Box < i32 > {
72
85
x
73
86
}
74
87
75
- // CHECK: @struct_return(%S* noalias nocapture sret(%S) dereferenceable(32){{( %0)?}})
88
+ // CHECK: @struct_return(%S* noalias nocapture noundef sret(%S) dereferenceable(32){{( %0)?}})
76
89
#[ no_mangle]
77
90
pub fn struct_return ( ) -> S {
78
91
S {
@@ -86,48 +99,58 @@ pub fn struct_return() -> S {
86
99
pub fn helper ( _: usize ) {
87
100
}
88
101
89
- // CHECK: @slice([0 x i8]* noalias nonnull readonly align 1 %_1.0, [[USIZE]] %_1.1)
102
+ // CHECK: @slice([0 x i8]* noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] %_1.1)
90
103
// FIXME #25759 This should also have `nocapture`
91
104
#[ no_mangle]
92
105
pub fn slice ( _: & [ u8 ] ) {
93
106
}
94
107
95
- // CHECK: @mutable_slice([0 x i8]* noalias nonnull align 1 %_1.0, [[USIZE]] %_1.1)
108
+ // CHECK: @mutable_slice([0 x i8]* noalias noundef nonnull align 1 %_1.0, [[USIZE]] %_1.1)
96
109
// FIXME #25759 This should also have `nocapture`
97
110
#[ no_mangle]
98
111
pub fn mutable_slice ( _: & mut [ u8 ] ) {
99
112
}
100
113
101
- // CHECK: @unsafe_slice([0 x i16]* nonnull align 2 %_1.0, [[USIZE]] %_1.1)
114
+ // CHECK: @unsafe_slice([0 x i16]* noundef nonnull align 2 %_1.0, [[USIZE]] %_1.1)
102
115
// unsafe interior means this isn't actually readonly and there may be aliases ...
103
116
#[ no_mangle]
104
117
pub fn unsafe_slice ( _: & [ UnsafeInner ] ) {
105
118
}
106
119
107
- // CHECK: @str([0 x i8]* noalias nonnull readonly align 1 %_1.0, [[USIZE]] %_1.1)
120
+ // CHECK: @raw_slice([0 x i8]* %_1.0, [[USIZE]] %_1.1)
121
+ #[ no_mangle]
122
+ pub fn raw_slice ( _: * const [ u8 ] ) {
123
+ }
124
+
125
+ // CHECK: @str([0 x i8]* noalias noundef nonnull readonly align 1 %_1.0, [[USIZE]] %_1.1)
108
126
// FIXME #25759 This should also have `nocapture`
109
127
#[ no_mangle]
110
128
pub fn str ( _: & [ u8 ] ) {
111
129
}
112
130
113
- // CHECK: @trait_borrow({}* nonnull align 1 %_1.0, [3 x [[USIZE]]]* noalias readonly align {{.*}} dereferenceable({{.*}}) %_1.1)
131
+ // CHECK: @trait_borrow({}* noundef nonnull align 1 %_1.0, [3 x [[USIZE]]]* noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1)
114
132
// FIXME #25759 This should also have `nocapture`
115
133
#[ no_mangle]
116
134
pub fn trait_borrow ( _: & Drop ) {
117
135
}
118
136
119
- // CHECK: @trait_box({}* noalias nonnull align 1{{( %0)?}}, [3 x [[USIZE]]]* noalias readonly align {{.*}} dereferenceable({{.*}}){{( %1)?}})
137
+ // CHECK: @trait_raw({}* %_1.0, [3 x [[USIZE]]]* noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %_1.1)
138
+ #[ no_mangle]
139
+ pub fn trait_raw ( _: * const Drop ) {
140
+ }
141
+
142
+ // CHECK: @trait_box({}* noalias noundef nonnull align 1{{( %0)?}}, [3 x [[USIZE]]]* noalias noundef readonly align {{.*}} dereferenceable({{.*}}){{( %1)?}})
120
143
#[ no_mangle]
121
144
pub fn trait_box ( _: Box < Drop > ) {
122
145
}
123
146
124
- // CHECK: { i8*, i8* } @trait_option(i8* noalias align 1 %x.0, i8* %x.1)
147
+ // CHECK: { i8*, i8* } @trait_option(i8* noalias noundef align 1 %x.0, i8* %x.1)
125
148
#[ no_mangle]
126
149
pub fn trait_option ( x : Option < Box < Drop > > ) -> Option < Box < Drop > > {
127
150
x
128
151
}
129
152
130
- // CHECK: { [0 x i16]*, [[USIZE]] } @return_slice([0 x i16]* noalias nonnull readonly align 2 %x.0, [[USIZE]] %x.1)
153
+ // CHECK: { [0 x i16]*, [[USIZE]] } @return_slice([0 x i16]* noalias noundef nonnull readonly align 2 %x.0, [[USIZE]] %x.1)
131
154
#[ no_mangle]
132
155
pub fn return_slice ( x : & [ u16 ] ) -> & [ u16 ] {
133
156
x
@@ -139,7 +162,7 @@ pub fn enum_id_1(x: Option<Result<u16, u16>>) -> Option<Result<u16, u16>> {
139
162
x
140
163
}
141
164
142
- // CHECK: { i8, i8 } @enum_id_2(i1 zeroext %x.0, i8 %x.1)
165
+ // CHECK: { i8, i8 } @enum_id_2(i1 noundef zeroext %x.0, i8 %x.1)
143
166
#[ no_mangle]
144
167
pub fn enum_id_2 ( x : Option < u8 > ) -> Option < u8 > {
145
168
x
0 commit comments