@@ -1763,9 +1763,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17631763 & mut self ,
17641764 fn_name : & ' ll Value ,
17651765 hash : & ' ll Value ,
1766- bitmap_bytes : & ' ll Value ,
1766+ bitmap_bits : & ' ll Value ,
17671767 ) {
1768- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1768+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
17691769
17701770 assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
17711771
@@ -1774,7 +1774,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17741774 & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
17751775 self . cx . type_void ( ) ,
17761776 ) ;
1777- let args = & [ fn_name, hash, bitmap_bytes ] ;
1777+ let args = & [ fn_name, hash, bitmap_bits ] ;
17781778 let args = self . check_call ( "call" , llty, llfn, args) ;
17791779
17801780 unsafe {
@@ -1794,29 +1794,22 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17941794 & mut self ,
17951795 fn_name : & ' ll Value ,
17961796 hash : & ' ll Value ,
1797- bitmap_bytes : & ' ll Value ,
17981797 bitmap_index : & ' ll Value ,
17991798 mcdc_temp : & ' ll Value ,
18001799 ) {
18011800 debug ! (
1802- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1803- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1801+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1802+ fn_name, hash, bitmap_index, mcdc_temp
18041803 ) ;
18051804 assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
18061805
18071806 let llfn =
18081807 unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
18091808 let llty = self . cx . type_func (
1810- & [
1811- self . cx . type_ptr ( ) ,
1812- self . cx . type_i64 ( ) ,
1813- self . cx . type_i32 ( ) ,
1814- self . cx . type_i32 ( ) ,
1815- self . cx . type_ptr ( ) ,
1816- ] ,
1809+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
18171810 self . cx . type_void ( ) ,
18181811 ) ;
1819- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1812+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
18201813 let args = self . check_call ( "call" , llty, llfn, args) ;
18211814 unsafe {
18221815 let _ = llvm:: LLVMRustBuildCall (
@@ -1832,42 +1825,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
18321825 self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
18331826 }
18341827
1835- pub ( crate ) fn mcdc_condbitmap_update (
1836- & mut self ,
1837- fn_name : & ' ll Value ,
1838- hash : & ' ll Value ,
1839- cond_loc : & ' ll Value ,
1840- mcdc_temp : & ' ll Value ,
1841- bool_value : & ' ll Value ,
1842- ) {
1843- debug ! (
1844- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})" ,
1845- fn_name, hash, cond_loc, mcdc_temp, bool_value
1846- ) ;
1828+ pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1829+ debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
18471830 assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1848- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1849- let llty = self . cx . type_func (
1850- & [
1851- self . cx . type_ptr ( ) ,
1852- self . cx . type_i64 ( ) ,
1853- self . cx . type_i32 ( ) ,
1854- self . cx . type_ptr ( ) ,
1855- self . cx . type_i1 ( ) ,
1856- ] ,
1857- self . cx . type_void ( ) ,
1858- ) ;
1859- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1860- self . check_call ( "call" , llty, llfn, args) ;
1861- unsafe {
1862- let _ = llvm:: LLVMRustBuildCall (
1863- self . llbuilder ,
1864- llty,
1865- llfn,
1866- args. as_ptr ( ) as * const & llvm:: Value ,
1867- args. len ( ) as c_uint ,
1868- [ ] . as_ptr ( ) ,
1869- 0 as c_uint ,
1870- ) ;
1871- }
1831+ let align = self . tcx . data_layout . i32_align . abi ;
1832+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1833+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1834+ self . store ( new_tv_index, mcdc_temp, align) ;
18721835 }
18731836}
0 commit comments