@@ -165,7 +165,6 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
165
165
let ptr = args[ 0 ] . immediate ( ) ;
166
166
let load = if let PassMode :: Cast ( ty, _) = & fn_abi. ret . mode {
167
167
let llty = ty. llvm_type ( self ) ;
168
- let ptr = self . pointercast ( ptr, self . type_ptr ( ) ) ;
169
168
self . volatile_load ( llty, ptr)
170
169
} else {
171
170
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> {
319
318
self . const_bool ( true )
320
319
} else if use_integer_compare {
321
320
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 ) ;
327
323
self . icmp ( IntPredicate :: IntEQ , a_val, b_val)
328
324
} 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) ;
332
325
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] ) ;
334
327
match self . cx . sess ( ) . target . arch . as_ref ( ) {
335
328
"avr" | "msp430" => self . icmp ( IntPredicate :: IntEQ , cmp, self . const_i16 ( 0 ) ) ,
336
329
_ => self . icmp ( IntPredicate :: IntEQ , cmp, self . const_i32 ( 0 ) ) ,
@@ -386,9 +379,7 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
386
379
387
380
if !fn_abi. ret . is_ignore ( ) {
388
381
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 ) ;
392
383
} else {
393
384
OperandRef :: from_immediate_or_packed_pair ( self , llval, result. layout )
394
385
. val
@@ -412,9 +403,7 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
412
403
fn type_test ( & mut self , pointer : Self :: Value , typeid : Self :: Value ) -> Self :: Value {
413
404
// Test the called operand using llvm.type.test intrinsic. The LowerTypeTests link-time
414
405
// 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] )
418
407
}
419
408
420
409
fn type_checked_load (
@@ -748,7 +737,6 @@ fn codegen_emcc_try<'ll>(
748
737
let catch_data_1 =
749
738
bx. inbounds_gep ( catch_data_type, catch_data, & [ bx. const_usize ( 0 ) , bx. const_usize ( 1 ) ] ) ;
750
739
bx. store ( is_rust_panic, catch_data_1, i8_align) ;
751
- let catch_data = bx. bitcast ( catch_data, bx. type_ptr ( ) ) ;
752
740
753
741
let catch_ty = bx. type_func ( & [ bx. type_ptr ( ) , bx. type_ptr ( ) ] , bx. type_void ( ) ) ;
754
742
bx. call ( catch_ty, None , catch_func, & [ data, catch_data] , None ) ;
@@ -897,8 +885,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
897
885
let place = PlaceRef :: alloca ( bx, args[ 0 ] . layout ) ;
898
886
args[ 0 ] . val . store ( bx, place) ;
899
887
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 )
902
889
}
903
890
_ => return_error ! (
904
891
"invalid bitmask `{}`, expected `u{}` or `[u8; {}]`" ,
@@ -1145,7 +1132,6 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
1145
1132
let ptr = bx. alloca ( bx. type_ix ( expected_bytes * 8 ) , Align :: ONE ) ;
1146
1133
bx. store ( ze, ptr, Align :: ONE ) ;
1147
1134
let array_ty = bx. type_array ( bx. type_i8 ( ) , expected_bytes) ;
1148
- let ptr = bx. pointercast ( ptr, bx. cx . type_ptr ( ) ) ;
1149
1135
return Ok ( bx. load ( array_ty, ptr, Align :: ONE ) ) ;
1150
1136
}
1151
1137
_ => return_error ! (
@@ -1763,11 +1749,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
1763
1749
_ => return_error ! ( "expected pointer, got `{}`" , out_elem) ,
1764
1750
}
1765
1751
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 ( ) ) ;
1771
1753
}
1772
1754
1773
1755
if name == sym:: simd_expose_addr {
0 commit comments