@@ -1751,9 +1751,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17511751 & mut self ,
17521752 fn_name : & ' ll Value ,
17531753 hash : & ' ll Value ,
1754- bitmap_bytes : & ' ll Value ,
1754+ bitmap_bits : & ' ll Value ,
17551755 ) {
1756- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1756+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
17571757
17581758 assert ! (
17591759 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1765,7 +1765,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17651765 & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
17661766 self . cx . type_void ( ) ,
17671767 ) ;
1768- let args = & [ fn_name, hash, bitmap_bytes ] ;
1768+ let args = & [ fn_name, hash, bitmap_bits ] ;
17691769 let args = self . check_call ( "call" , llty, llfn, args) ;
17701770
17711771 unsafe {
@@ -1785,13 +1785,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17851785 & mut self ,
17861786 fn_name : & ' ll Value ,
17871787 hash : & ' ll Value ,
1788- bitmap_bytes : & ' ll Value ,
17891788 bitmap_index : & ' ll Value ,
17901789 mcdc_temp : & ' ll Value ,
17911790 ) {
17921791 debug ! (
1793- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1794- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1792+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1793+ fn_name, hash, bitmap_index, mcdc_temp
17951794 ) ;
17961795 assert ! (
17971796 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1801,16 +1800,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
18011800 let llfn =
18021801 unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
18031802 let llty = self . cx . type_func (
1804- & [
1805- self . cx . type_ptr ( ) ,
1806- self . cx . type_i64 ( ) ,
1807- self . cx . type_i32 ( ) ,
1808- self . cx . type_i32 ( ) ,
1809- self . cx . type_ptr ( ) ,
1810- ] ,
1803+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
18111804 self . cx . type_void ( ) ,
18121805 ) ;
1813- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1806+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
18141807 let args = self . check_call ( "call" , llty, llfn, args) ;
18151808 unsafe {
18161809 let _ = llvm:: LLVMRustBuildCall (
@@ -1826,45 +1819,15 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
18261819 self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
18271820 }
18281821
1829- pub ( crate ) fn mcdc_condbitmap_update (
1830- & mut self ,
1831- fn_name : & ' ll Value ,
1832- hash : & ' ll Value ,
1833- cond_loc : & ' ll Value ,
1834- mcdc_temp : & ' ll Value ,
1835- bool_value : & ' ll Value ,
1836- ) {
1837- debug ! (
1838- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})" ,
1839- fn_name, hash, cond_loc, mcdc_temp, bool_value
1840- ) ;
1822+ pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1823+ debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
18411824 assert ! (
18421825 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
18431826 "MCDC intrinsics require LLVM 19 or later"
18441827 ) ;
1845- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1846- let llty = self . cx . type_func (
1847- & [
1848- self . cx . type_ptr ( ) ,
1849- self . cx . type_i64 ( ) ,
1850- self . cx . type_i32 ( ) ,
1851- self . cx . type_ptr ( ) ,
1852- self . cx . type_i1 ( ) ,
1853- ] ,
1854- self . cx . type_void ( ) ,
1855- ) ;
1856- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1857- self . check_call ( "call" , llty, llfn, args) ;
1858- unsafe {
1859- let _ = llvm:: LLVMRustBuildCall (
1860- self . llbuilder ,
1861- llty,
1862- llfn,
1863- args. as_ptr ( ) as * const & llvm:: Value ,
1864- args. len ( ) as c_uint ,
1865- [ ] . as_ptr ( ) ,
1866- 0 as c_uint ,
1867- ) ;
1868- }
1828+ let align = self . tcx . data_layout . i32_align . abi ;
1829+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1830+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1831+ self . store ( new_tv_index, mcdc_temp, align) ;
18691832 }
18701833}
0 commit comments