@@ -652,7 +652,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
652652 flags : MemFlags ,
653653 ) -> & ' ll Value {
654654 debug ! ( "Store {:?} -> {:?} ({:?})" , val, ptr, flags) ;
655- let ptr = self . check_store ( val , ptr ) ;
655+ assert_eq ! ( self . cx . type_kind ( self . cx . val_ty ( ptr ) ) , TypeKind :: Pointer ) ;
656656 unsafe {
657657 let store = llvm:: LLVMBuildStore ( self . llbuilder , val, ptr) ;
658658 let align =
@@ -682,7 +682,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
682682 size : Size ,
683683 ) {
684684 debug ! ( "Store {:?} -> {:?}" , val, ptr) ;
685- let ptr = self . check_store ( val , ptr ) ;
685+ assert_eq ! ( self . cx . type_kind ( self . cx . val_ty ( ptr ) ) , TypeKind :: Pointer ) ;
686686 unsafe {
687687 let store = llvm:: LLVMRustBuildAtomicStore (
688688 self . llbuilder ,
@@ -873,8 +873,6 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
873873 assert ! ( !flags. contains( MemFlags :: NONTEMPORAL ) , "non-temporal memcpy not supported" ) ;
874874 let size = self . intcast ( size, self . type_isize ( ) , false ) ;
875875 let is_volatile = flags. contains ( MemFlags :: VOLATILE ) ;
876- let dst = self . pointercast ( dst, self . type_i8p ( ) ) ;
877- let src = self . pointercast ( src, self . type_i8p ( ) ) ;
878876 unsafe {
879877 llvm:: LLVMRustBuildMemCpy (
880878 self . llbuilder ,
@@ -900,8 +898,6 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
900898 assert ! ( !flags. contains( MemFlags :: NONTEMPORAL ) , "non-temporal memmove not supported" ) ;
901899 let size = self . intcast ( size, self . type_isize ( ) , false ) ;
902900 let is_volatile = flags. contains ( MemFlags :: VOLATILE ) ;
903- let dst = self . pointercast ( dst, self . type_i8p ( ) ) ;
904- let src = self . pointercast ( src, self . type_i8p ( ) ) ;
905901 unsafe {
906902 llvm:: LLVMRustBuildMemMove (
907903 self . llbuilder ,
@@ -924,7 +920,6 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
924920 flags : MemFlags ,
925921 ) {
926922 let is_volatile = flags. contains ( MemFlags :: VOLATILE ) ;
927- let ptr = self . pointercast ( ptr, self . type_i8p ( ) ) ;
928923 unsafe {
929924 llvm:: LLVMRustBuildMemSet (
930925 self . llbuilder ,
@@ -981,7 +976,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
981976 }
982977
983978 fn cleanup_landing_pad ( & mut self , pers_fn : & ' ll Value ) -> ( & ' ll Value , & ' ll Value ) {
984- let ty = self . type_struct ( & [ self . type_i8p ( ) , self . type_i32 ( ) ] , false ) ;
979+ let ty = self . type_struct ( & [ self . type_ptr ( ) , self . type_i32 ( ) ] , false ) ;
985980 let landing_pad = self . landing_pad ( ty, pers_fn, 0 ) ;
986981 unsafe {
987982 llvm:: LLVMSetCleanup ( landing_pad, llvm:: True ) ;
@@ -990,14 +985,14 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
990985 }
991986
992987 fn filter_landing_pad ( & mut self , pers_fn : & ' ll Value ) -> ( & ' ll Value , & ' ll Value ) {
993- let ty = self . type_struct ( & [ self . type_i8p ( ) , self . type_i32 ( ) ] , false ) ;
988+ let ty = self . type_struct ( & [ self . type_ptr ( ) , self . type_i32 ( ) ] , false ) ;
994989 let landing_pad = self . landing_pad ( ty, pers_fn, 1 ) ;
995- self . add_clause ( landing_pad, self . const_array ( self . type_i8p ( ) , & [ ] ) ) ;
990+ self . add_clause ( landing_pad, self . const_array ( self . type_ptr ( ) , & [ ] ) ) ;
996991 ( self . extract_value ( landing_pad, 0 ) , self . extract_value ( landing_pad, 1 ) )
997992 }
998993
999994 fn resume ( & mut self , exn0 : & ' ll Value , exn1 : & ' ll Value ) {
1000- let ty = self . type_struct ( & [ self . type_i8p ( ) , self . type_i32 ( ) ] , false ) ;
995+ let ty = self . type_struct ( & [ self . type_ptr ( ) , self . type_i32 ( ) ] , false ) ;
1001996 let mut exn = self . const_poison ( ty) ;
1002997 exn = self . insert_value ( exn, exn0, 0 ) ;
1003998 exn = self . insert_value ( exn, exn1, 1 ) ;
@@ -1161,7 +1156,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
11611156
11621157 let llfn = unsafe { llvm:: LLVMRustGetInstrProfIncrementIntrinsic ( self . cx ( ) . llmod ) } ;
11631158 let llty = self . cx . type_func (
1164- & [ self . cx . type_i8p ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_i32 ( ) ] ,
1159+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_i32 ( ) ] ,
11651160 self . cx . type_void ( ) ,
11661161 ) ;
11671162 let args = & [ fn_name, hash, num_counters, index] ;
@@ -1387,25 +1382,6 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
13871382 ret. expect ( "LLVM does not have support for catchret" )
13881383 }
13891384
1390- fn check_store ( & mut self , val : & ' ll Value , ptr : & ' ll Value ) -> & ' ll Value {
1391- let dest_ptr_ty = self . cx . val_ty ( ptr) ;
1392- let stored_ty = self . cx . val_ty ( val) ;
1393- let stored_ptr_ty = self . cx . type_ptr_to ( stored_ty) ;
1394-
1395- assert_eq ! ( self . cx. type_kind( dest_ptr_ty) , TypeKind :: Pointer ) ;
1396-
1397- if dest_ptr_ty == stored_ptr_ty {
1398- ptr
1399- } else {
1400- debug ! (
1401- "type mismatch in store. \
1402- Expected {:?}, got {:?}; inserting bitcast",
1403- dest_ptr_ty, stored_ptr_ty
1404- ) ;
1405- self . bitcast ( ptr, stored_ptr_ty)
1406- }
1407- }
1408-
14091385 fn check_call < ' b > (
14101386 & mut self ,
14111387 typ : & str ,
@@ -1466,7 +1442,6 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
14661442 return ;
14671443 }
14681444
1469- let ptr = self . pointercast ( ptr, self . cx . type_i8p ( ) ) ;
14701445 self . call_intrinsic ( intrinsic, & [ self . cx . const_u64 ( size) , ptr] ) ;
14711446 }
14721447
0 commit comments