@@ -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 ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
17591759
@@ -1762,7 +1762,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17621762 & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
17631763 self . cx . type_void ( ) ,
17641764 ) ;
1765- let args = & [ fn_name, hash, bitmap_bytes ] ;
1765+ let args = & [ fn_name, hash, bitmap_bits ] ;
17661766 let args = self . check_call ( "call" , llty, llfn, args) ;
17671767
17681768 unsafe {
@@ -1782,29 +1782,22 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17821782 & mut self ,
17831783 fn_name : & ' ll Value ,
17841784 hash : & ' ll Value ,
1785- bitmap_bytes : & ' ll Value ,
17861785 bitmap_index : & ' ll Value ,
17871786 mcdc_temp : & ' ll Value ,
17881787 ) {
17891788 debug ! (
1790- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1791- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1789+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1790+ fn_name, hash, bitmap_index, mcdc_temp
17921791 ) ;
17931792 assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
17941793
17951794 let llfn =
17961795 unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
17971796 let llty = self . cx . type_func (
1798- & [
1799- self . cx . type_ptr ( ) ,
1800- self . cx . type_i64 ( ) ,
1801- self . cx . type_i32 ( ) ,
1802- self . cx . type_i32 ( ) ,
1803- self . cx . type_ptr ( ) ,
1804- ] ,
1797+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
18051798 self . cx . type_void ( ) ,
18061799 ) ;
1807- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1800+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
18081801 let args = self . check_call ( "call" , llty, llfn, args) ;
18091802 unsafe {
18101803 let _ = llvm:: LLVMRustBuildCall (
@@ -1820,42 +1813,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
18201813 self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
18211814 }
18221815
1823- pub ( crate ) fn mcdc_condbitmap_update (
1824- & mut self ,
1825- fn_name : & ' ll Value ,
1826- hash : & ' ll Value ,
1827- cond_loc : & ' ll Value ,
1828- mcdc_temp : & ' ll Value ,
1829- bool_value : & ' ll Value ,
1830- ) {
1831- debug ! (
1832- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})" ,
1833- fn_name, hash, cond_loc, mcdc_temp, bool_value
1834- ) ;
1816+ pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1817+ debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
18351818 assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1836- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1837- let llty = self . cx . type_func (
1838- & [
1839- self . cx . type_ptr ( ) ,
1840- self . cx . type_i64 ( ) ,
1841- self . cx . type_i32 ( ) ,
1842- self . cx . type_ptr ( ) ,
1843- self . cx . type_i1 ( ) ,
1844- ] ,
1845- self . cx . type_void ( ) ,
1846- ) ;
1847- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1848- self . check_call ( "call" , llty, llfn, args) ;
1849- unsafe {
1850- let _ = llvm:: LLVMRustBuildCall (
1851- self . llbuilder ,
1852- llty,
1853- llfn,
1854- args. as_ptr ( ) as * const & llvm:: Value ,
1855- args. len ( ) as c_uint ,
1856- [ ] . as_ptr ( ) ,
1857- 0 as c_uint ,
1858- ) ;
1859- }
1819+ let align = self . tcx . data_layout . i32_align . abi ;
1820+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1821+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1822+ self . store ( new_tv_index, mcdc_temp, align) ;
18601823 }
18611824}
0 commit comments