@@ -83,38 +83,6 @@ fn get_simple_intrinsic(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
83
83
Some ( ccx. get_intrinsic ( & llvm_name) )
84
84
}
85
85
86
- fn warn_if_size_is_weird < ' a , ' tcx > ( bcx : & Builder < ' a , ' tcx > ,
87
- tp_ty : Ty < ' tcx > ,
88
- count : ValueRef ,
89
- span : Span ,
90
- name : & str ) {
91
- let ccx = bcx. ccx ;
92
- let lltp_ty = type_of:: type_of ( ccx, tp_ty) ;
93
- let ty_size = machine:: llsize_of ( ccx, lltp_ty) ;
94
- let total = const_to_uint ( bcx. mul ( ty_size, count) ) ;
95
-
96
- if total > 0 {
97
- return ;
98
- }
99
-
100
- let text = format ! ( "suspicious monomorphization of `{}` intrinsic" , name) ;
101
- let note = match name
102
- {
103
- "volatile_load" | "volatile_store" =>
104
- format ! ( "'{}' was specialized with zero-sized type '{}'" ,
105
- name, tp_ty) ,
106
- _ => format ! ( "'{}' was specialized with type '{}', number of \
107
- elements is {}",
108
- name, tp_ty,
109
- const_to_uint( count) )
110
- } ;
111
-
112
- let sess = bcx. sess ( ) ;
113
- sess. struct_span_warn ( span, & text)
114
- . note ( & note)
115
- . emit ( ) ;
116
- }
117
-
118
86
/// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs,
119
87
/// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics,
120
88
/// add them to librustc_trans/trans/context.rs
@@ -249,24 +217,17 @@ pub fn trans_intrinsic_call<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
249
217
}
250
218
251
219
"volatile_copy_nonoverlapping_memory" => {
252
- let tp_ty = substs. type_at ( 0 ) ;
253
- warn_if_size_is_weird ( bcx, tp_ty, llargs[ 2 ] , span, name) ;
254
- copy_intrinsic ( bcx, false , true , tp_ty, llargs[ 0 ] , llargs[ 1 ] , llargs[ 2 ] )
220
+ copy_intrinsic ( bcx, false , true , substs. type_at ( 0 ) , llargs[ 0 ] , llargs[ 1 ] , llargs[ 2 ] )
255
221
}
256
222
"volatile_copy_memory" => {
257
- let tp_ty = substs. type_at ( 0 ) ;
258
- warn_if_size_is_weird ( bcx, tp_ty, llargs[ 2 ] , span, name) ;
259
- copy_intrinsic ( bcx, true , true , tp_ty, llargs[ 0 ] , llargs[ 1 ] , llargs[ 2 ] )
223
+ copy_intrinsic ( bcx, true , true , substs. type_at ( 0 ) , llargs[ 0 ] , llargs[ 1 ] , llargs[ 2 ] )
260
224
}
261
225
"volatile_set_memory" => {
262
- let tp_ty = substs. type_at ( 0 ) ;
263
- warn_if_size_is_weird ( bcx, tp_ty, llargs[ 2 ] , span, name) ;
264
- memset_intrinsic ( bcx, true , tp_ty, llargs[ 0 ] , llargs[ 1 ] , llargs[ 2 ] )
226
+ memset_intrinsic ( bcx, true , substs. type_at ( 0 ) , llargs[ 0 ] , llargs[ 1 ] , llargs[ 2 ] )
265
227
}
266
228
"volatile_load" => {
267
229
let tp_ty = substs. type_at ( 0 ) ;
268
230
let mut ptr = llargs[ 0 ] ;
269
- warn_if_size_is_weird ( bcx, tp_ty, C_uint ( ccx, 1usize ) , span, name) ;
270
231
if let Some ( ty) = fn_ty. ret . cast {
271
232
ptr = bcx. pointercast ( ptr, ty. ptr_to ( ) ) ;
272
233
}
@@ -278,7 +239,6 @@ pub fn trans_intrinsic_call<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
278
239
} ,
279
240
"volatile_store" => {
280
241
let tp_ty = substs. type_at ( 0 ) ;
281
- warn_if_size_is_weird ( bcx, tp_ty, C_uint ( ccx, 1usize ) , span, name) ;
282
242
if type_is_fat_ptr ( bcx. ccx , tp_ty) {
283
243
bcx. volatile_store ( llargs[ 1 ] , get_dataptr ( bcx, llargs[ 0 ] ) ) ;
284
244
bcx. volatile_store ( llargs[ 2 ] , get_meta ( bcx, llargs[ 0 ] ) ) ;
0 commit comments