33#![ crate_type = "lib" ]
44#![ feature( rustc_attrs) ]
55
6+ use std:: mem:: MaybeUninit ;
7+
68pub struct S {
79 _field : [ i32 ; 8 ] ,
810}
@@ -11,68 +13,79 @@ pub struct UnsafeInner {
1113 _field : std:: cell:: UnsafeCell < i16 > ,
1214}
1315
14- // CHECK: zeroext i1 @boolean(i1 zeroext %x)
16+ // CHECK: noundef zeroext i1 @boolean(i1 noundef zeroext %x)
1517#[ no_mangle]
1618pub fn boolean ( x : bool ) -> bool {
1719 x
1820}
1921
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)
2129// FIXME #25759 This should also have `nocapture`
2230#[ no_mangle]
2331pub fn readonly_borrow ( _: & i32 ) {
2432}
2533
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)
2735// static borrow may be captured
2836#[ no_mangle]
2937pub fn static_borrow ( _: & ' static i32 ) {
3038}
3139
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)
3341// borrow with named lifetime may be captured
3442#[ no_mangle]
3543pub fn named_borrow < ' r > ( _: & ' r i32 ) {
3644}
3745
38- // CHECK: @unsafe_borrow(i16* align 2 dereferenceable(2) %_1)
46+ // CHECK: @unsafe_borrow(i16* noundef align 2 dereferenceable(2) %_1)
3947// unsafe interior means this isn't actually readonly and there may be aliases ...
4048#[ no_mangle]
4149pub fn unsafe_borrow ( _: & UnsafeInner ) {
4250}
4351
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)
4553// ... unless this is a mutable borrow, those never alias
4654#[ no_mangle]
4755pub fn mutable_unsafe_borrow ( _: & mut UnsafeInner ) {
4856}
4957
50- // CHECK: @mutable_borrow(i32* noalias align 4 dereferenceable(4) %_1)
58+ // CHECK: @mutable_borrow(i32* noalias noundef align 4 dereferenceable(4) %_1)
5159// FIXME #25759 This should also have `nocapture`
5260#[ no_mangle]
5361pub fn mutable_borrow ( _: & mut i32 ) {
5462}
5563
56- // CHECK: @indirect_struct(%S* noalias nocapture dereferenceable(32) %_1)
64+ // CHECK: @indirect_struct(%S* noalias nocapture noundef dereferenceable(32) %_1)
5765#[ no_mangle]
5866pub fn indirect_struct ( _: S ) {
5967}
6068
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)
6270// FIXME #25759 This should also have `nocapture`
6371#[ no_mangle]
6472pub fn borrowed_struct ( _: & S ) {
6573}
6674
75+ // CHECK: @raw_struct(%S* %_1)
76+ #[ no_mangle]
77+ pub fn raw_struct ( _: * const S ) {
78+ }
79+
6780// `Box` can get deallocated during execution of the function, so it should
6881// 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)
7083#[ no_mangle]
7184pub fn _box ( x : Box < i32 > ) -> Box < i32 > {
7285 x
7386}
7487
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)?}})
7689#[ no_mangle]
7790pub fn struct_return ( ) -> S {
7891 S {
@@ -86,48 +99,58 @@ pub fn struct_return() -> S {
8699pub fn helper ( _: usize ) {
87100}
88101
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)
90103// FIXME #25759 This should also have `nocapture`
91104#[ no_mangle]
92105pub fn slice ( _: & [ u8 ] ) {
93106}
94107
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)
96109// FIXME #25759 This should also have `nocapture`
97110#[ no_mangle]
98111pub fn mutable_slice ( _: & mut [ u8 ] ) {
99112}
100113
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)
102115// unsafe interior means this isn't actually readonly and there may be aliases ...
103116#[ no_mangle]
104117pub fn unsafe_slice ( _: & [ UnsafeInner ] ) {
105118}
106119
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)
108126// FIXME #25759 This should also have `nocapture`
109127#[ no_mangle]
110128pub fn str ( _: & [ u8 ] ) {
111129}
112130
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)
114132// FIXME #25759 This should also have `nocapture`
115133#[ no_mangle]
116134pub fn trait_borrow ( _: & Drop ) {
117135}
118136
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)?}})
120143#[ no_mangle]
121144pub fn trait_box ( _: Box < Drop > ) {
122145}
123146
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)
125148#[ no_mangle]
126149pub fn trait_option ( x : Option < Box < Drop > > ) -> Option < Box < Drop > > {
127150 x
128151}
129152
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)
131154#[ no_mangle]
132155pub fn return_slice ( x : & [ u16 ] ) -> & [ u16 ] {
133156 x
@@ -139,7 +162,7 @@ pub fn enum_id_1(x: Option<Result<u16, u16>>) -> Option<Result<u16, u16>> {
139162 x
140163}
141164
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)
143166#[ no_mangle]
144167pub fn enum_id_2 ( x : Option < u8 > ) -> Option < u8 > {
145168 x
0 commit comments