@@ -165,7 +165,6 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
165165 let ptr = args[ 0 ] . immediate ( ) ;
166166 let load = if let PassMode :: Cast ( ty, _) = & fn_abi. ret . mode {
167167 let llty = ty. llvm_type ( self ) ;
168- let ptr = self . pointercast ( ptr, self . type_ptr ( ) ) ;
169168 self . volatile_load ( llty, ptr)
170169 } else {
171170 self . volatile_load ( self . layout_of ( tp_ty) . llvm_type ( self ) , ptr)
@@ -319,18 +318,12 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
319318 self . const_bool ( true )
320319 } else if use_integer_compare {
321320 let integer_ty = self . type_ix ( layout. size ( ) . bits ( ) ) ;
322- let ptr_ty = self . type_ptr ( ) ;
323- let a_ptr = self . bitcast ( a, ptr_ty) ;
324- let a_val = self . load ( integer_ty, a_ptr, layout. align ( ) . abi ) ;
325- let b_ptr = self . bitcast ( b, ptr_ty) ;
326- let b_val = self . load ( integer_ty, b_ptr, layout. align ( ) . abi ) ;
321+ let a_val = self . load ( integer_ty, a, layout. align ( ) . abi ) ;
322+ let b_val = self . load ( integer_ty, b, layout. align ( ) . abi ) ;
327323 self . icmp ( IntPredicate :: IntEQ , a_val, b_val)
328324 } else {
329- let ptr_ty = self . type_ptr ( ) ;
330- let a_ptr = self . bitcast ( a, ptr_ty) ;
331- let b_ptr = self . bitcast ( b, ptr_ty) ;
332325 let n = self . const_usize ( layout. size ( ) . bytes ( ) ) ;
333- let cmp = self . call_intrinsic ( "memcmp" , & [ a_ptr , b_ptr , n] ) ;
326+ let cmp = self . call_intrinsic ( "memcmp" , & [ a , b , n] ) ;
334327 match self . cx . sess ( ) . target . arch . as_ref ( ) {
335328 "avr" | "msp430" => self . icmp ( IntPredicate :: IntEQ , cmp, self . const_i16 ( 0 ) ) ,
336329 _ => self . icmp ( IntPredicate :: IntEQ , cmp, self . const_i32 ( 0 ) ) ,
@@ -386,9 +379,7 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
386379
387380 if !fn_abi. ret . is_ignore ( ) {
388381 if let PassMode :: Cast ( _, _) = & fn_abi. ret . mode {
389- let ptr_llty = self . type_ptr ( ) ;
390- let ptr = self . pointercast ( result. llval , ptr_llty) ;
391- self . store ( llval, ptr, result. align ) ;
382+ self . store ( llval, result. llval , result. align ) ;
392383 } else {
393384 OperandRef :: from_immediate_or_packed_pair ( self , llval, result. layout )
394385 . val
@@ -412,9 +403,7 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
412403 fn type_test ( & mut self , pointer : Self :: Value , typeid : Self :: Value ) -> Self :: Value {
413404 // Test the called operand using llvm.type.test intrinsic. The LowerTypeTests link-time
414405 // optimization pass replaces calls to this intrinsic with code to test type membership.
415- let ptr_ty = self . type_ptr ( ) ;
416- let bitcast = self . bitcast ( pointer, ptr_ty) ;
417- self . call_intrinsic ( "llvm.type.test" , & [ bitcast, typeid] )
406+ self . call_intrinsic ( "llvm.type.test" , & [ pointer, typeid] )
418407 }
419408
420409 fn type_checked_load (
@@ -748,7 +737,6 @@ fn codegen_emcc_try<'ll>(
748737 let catch_data_1 =
749738 bx. inbounds_gep ( catch_data_type, catch_data, & [ bx. const_usize ( 0 ) , bx. const_usize ( 1 ) ] ) ;
750739 bx. store ( is_rust_panic, catch_data_1, i8_align) ;
751- let catch_data = bx. bitcast ( catch_data, bx. type_ptr ( ) ) ;
752740
753741 let catch_ty = bx. type_func ( & [ bx. type_ptr ( ) , bx. type_ptr ( ) ] , bx. type_void ( ) ) ;
754742 bx. call ( catch_ty, None , catch_func, & [ data, catch_data] , None ) ;
@@ -897,8 +885,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
897885 let place = PlaceRef :: alloca ( bx, args[ 0 ] . layout ) ;
898886 args[ 0 ] . val . store ( bx, place) ;
899887 let int_ty = bx. type_ix ( expected_bytes * 8 ) ;
900- let ptr = bx. pointercast ( place. llval , bx. cx . type_ptr ( ) ) ;
901- bx. load ( int_ty, ptr, Align :: ONE )
888+ bx. load ( int_ty, place. llval , Align :: ONE )
902889 }
903890 _ => return_error ! (
904891 "invalid bitmask `{}`, expected `u{}` or `[u8; {}]`" ,
@@ -1145,7 +1132,6 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
11451132 let ptr = bx. alloca ( bx. type_ix ( expected_bytes * 8 ) , Align :: ONE ) ;
11461133 bx. store ( ze, ptr, Align :: ONE ) ;
11471134 let array_ty = bx. type_array ( bx. type_i8 ( ) , expected_bytes) ;
1148- let ptr = bx. pointercast ( ptr, bx. cx . type_ptr ( ) ) ;
11491135 return Ok ( bx. load ( array_ty, ptr, Align :: ONE ) ) ;
11501136 }
11511137 _ => return_error ! (
@@ -1763,11 +1749,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
17631749 _ => return_error ! ( "expected pointer, got `{}`" , out_elem) ,
17641750 }
17651751
1766- if in_elem == out_elem {
1767- return Ok ( args[ 0 ] . immediate ( ) ) ;
1768- } else {
1769- return Ok ( bx. pointercast ( args[ 0 ] . immediate ( ) , llret_ty) ) ;
1770- }
1752+ return Ok ( args[ 0 ] . immediate ( ) ) ;
17711753 }
17721754
17731755 if name == sym:: simd_expose_addr {
0 commit comments