@@ -83,38 +83,6 @@ fn get_simple_intrinsic(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
8383 Some ( ccx. get_intrinsic ( & llvm_name) )
8484}
8585
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-
11886/// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs,
11987/// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics,
12088/// add them to librustc_trans/trans/context.rs
@@ -249,24 +217,17 @@ pub fn trans_intrinsic_call<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
249217 }
250218
251219 "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 ] )
255221 }
256222 "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 ] )
260224 }
261225 "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 ] )
265227 }
266228 "volatile_load" => {
267229 let tp_ty = substs. type_at ( 0 ) ;
268230 let mut ptr = llargs[ 0 ] ;
269- warn_if_size_is_weird ( bcx, tp_ty, C_uint ( ccx, 1usize ) , span, name) ;
270231 if let Some ( ty) = fn_ty. ret . cast {
271232 ptr = bcx. pointercast ( ptr, ty. ptr_to ( ) ) ;
272233 }
@@ -278,7 +239,6 @@ pub fn trans_intrinsic_call<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
278239 } ,
279240 "volatile_store" => {
280241 let tp_ty = substs. type_at ( 0 ) ;
281- warn_if_size_is_weird ( bcx, tp_ty, C_uint ( ccx, 1usize ) , span, name) ;
282242 if type_is_fat_ptr ( bcx. ccx , tp_ty) {
283243 bcx. volatile_store ( llargs[ 1 ] , get_dataptr ( bcx, llargs[ 0 ] ) ) ;
284244 bcx. volatile_store ( llargs[ 2 ] , get_meta ( bcx, llargs[ 0 ] ) ) ;
0 commit comments