@@ -1698,9 +1698,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16981698 & mut self ,
16991699 fn_name : & ' ll Value ,
17001700 hash : & ' ll Value ,
1701- bitmap_bytes : & ' ll Value ,
1701+ bitmap_bits : & ' ll Value ,
17021702 ) {
1703- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1703+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
17041704
17051705 assert ! (
17061706 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1712,7 +1712,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17121712 & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
17131713 self . cx . type_void ( ) ,
17141714 ) ;
1715- let args = & [ fn_name, hash, bitmap_bytes ] ;
1715+ let args = & [ fn_name, hash, bitmap_bits ] ;
17161716 let args = self . check_call ( "call" , llty, llfn, args) ;
17171717
17181718 unsafe {
@@ -1732,13 +1732,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17321732 & mut self ,
17331733 fn_name : & ' ll Value ,
17341734 hash : & ' ll Value ,
1735- bitmap_bytes : & ' ll Value ,
17361735 bitmap_index : & ' ll Value ,
17371736 mcdc_temp : & ' ll Value ,
17381737 ) {
17391738 debug ! (
1740- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1741- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1739+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1740+ fn_name, hash, bitmap_index, mcdc_temp
17421741 ) ;
17431742 assert ! (
17441743 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1748,16 +1747,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17481747 let llfn =
17491748 unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
17501749 let llty = self . cx . type_func (
1751- & [
1752- self . cx . type_ptr ( ) ,
1753- self . cx . type_i64 ( ) ,
1754- self . cx . type_i32 ( ) ,
1755- self . cx . type_i32 ( ) ,
1756- self . cx . type_ptr ( ) ,
1757- ] ,
1750+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
17581751 self . cx . type_void ( ) ,
17591752 ) ;
1760- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1753+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
17611754 let args = self . check_call ( "call" , llty, llfn, args) ;
17621755 unsafe {
17631756 let _ = llvm:: LLVMRustBuildCall (
@@ -1773,45 +1766,15 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17731766 self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
17741767 }
17751768
1776- pub ( crate ) fn mcdc_condbitmap_update (
1777- & mut self ,
1778- fn_name : & ' ll Value ,
1779- hash : & ' ll Value ,
1780- cond_loc : & ' ll Value ,
1781- mcdc_temp : & ' ll Value ,
1782- bool_value : & ' ll Value ,
1783- ) {
1784- debug ! (
1785- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})" ,
1786- fn_name, hash, cond_loc, mcdc_temp, bool_value
1787- ) ;
1769+ pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1770+ debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
17881771 assert ! (
17891772 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
17901773 "MCDC intrinsics require LLVM 19 or later"
17911774 ) ;
1792- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1793- let llty = self . cx . type_func (
1794- & [
1795- self . cx . type_ptr ( ) ,
1796- self . cx . type_i64 ( ) ,
1797- self . cx . type_i32 ( ) ,
1798- self . cx . type_ptr ( ) ,
1799- self . cx . type_i1 ( ) ,
1800- ] ,
1801- self . cx . type_void ( ) ,
1802- ) ;
1803- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1804- self . check_call ( "call" , llty, llfn, args) ;
1805- unsafe {
1806- let _ = llvm:: LLVMRustBuildCall (
1807- self . llbuilder ,
1808- llty,
1809- llfn,
1810- args. as_ptr ( ) as * const & llvm:: Value ,
1811- args. len ( ) as c_uint ,
1812- [ ] . as_ptr ( ) ,
1813- 0 as c_uint ,
1814- ) ;
1815- }
1775+ let align = self . tcx . data_layout . i32_align . abi ;
1776+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1777+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1778+ self . store ( new_tv_index, mcdc_temp, align) ;
18161779 }
18171780}
0 commit comments