@@ -1679,9 +1679,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16791679 & mut self ,
16801680 fn_name : & ' ll Value ,
16811681 hash : & ' ll Value ,
1682- bitmap_bytes : & ' ll Value ,
1682+ bitmap_bits : & ' ll Value ,
16831683 ) {
1684- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1684+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
16851685
16861686 assert ! (
16871687 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1693,7 +1693,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16931693 & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
16941694 self . cx . type_void ( ) ,
16951695 ) ;
1696- let args = & [ fn_name, hash, bitmap_bytes ] ;
1696+ let args = & [ fn_name, hash, bitmap_bits ] ;
16971697 let args = self . check_call ( "call" , llty, llfn, args) ;
16981698
16991699 unsafe {
@@ -1713,13 +1713,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17131713 & mut self ,
17141714 fn_name : & ' ll Value ,
17151715 hash : & ' ll Value ,
1716- bitmap_bytes : & ' ll Value ,
17171716 bitmap_index : & ' ll Value ,
17181717 mcdc_temp : & ' ll Value ,
17191718 ) {
17201719 debug ! (
1721- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1722- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1720+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1721+ fn_name, hash, bitmap_index, mcdc_temp
17231722 ) ;
17241723 assert ! (
17251724 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1729,16 +1728,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17291728 let llfn =
17301729 unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
17311730 let llty = self . cx . type_func (
1732- & [
1733- self . cx . type_ptr ( ) ,
1734- self . cx . type_i64 ( ) ,
1735- self . cx . type_i32 ( ) ,
1736- self . cx . type_i32 ( ) ,
1737- self . cx . type_ptr ( ) ,
1738- ] ,
1731+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
17391732 self . cx . type_void ( ) ,
17401733 ) ;
1741- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1734+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
17421735 let args = self . check_call ( "call" , llty, llfn, args) ;
17431736 unsafe {
17441737 let _ = llvm:: LLVMRustBuildCall (
@@ -1754,45 +1747,15 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
17541747 self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
17551748 }
17561749
1757- pub ( crate ) fn mcdc_condbitmap_update (
1758- & mut self ,
1759- fn_name : & ' ll Value ,
1760- hash : & ' ll Value ,
1761- cond_loc : & ' ll Value ,
1762- mcdc_temp : & ' ll Value ,
1763- bool_value : & ' ll Value ,
1764- ) {
1765- debug ! (
1766- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})" ,
1767- fn_name, hash, cond_loc, mcdc_temp, bool_value
1768- ) ;
1750+ pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1751+ debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
17691752 assert ! (
17701753 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
17711754 "MCDC intrinsics require LLVM 19 or later"
17721755 ) ;
1773- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1774- let llty = self . cx . type_func (
1775- & [
1776- self . cx . type_ptr ( ) ,
1777- self . cx . type_i64 ( ) ,
1778- self . cx . type_i32 ( ) ,
1779- self . cx . type_ptr ( ) ,
1780- self . cx . type_i1 ( ) ,
1781- ] ,
1782- self . cx . type_void ( ) ,
1783- ) ;
1784- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1785- self . check_call ( "call" , llty, llfn, args) ;
1786- unsafe {
1787- let _ = llvm:: LLVMRustBuildCall (
1788- self . llbuilder ,
1789- llty,
1790- llfn,
1791- args. as_ptr ( ) as * const & llvm:: Value ,
1792- args. len ( ) as c_uint ,
1793- [ ] . as_ptr ( ) ,
1794- 0 as c_uint ,
1795- ) ;
1796- }
1756+ let align = self . tcx . data_layout . i32_align . abi ;
1757+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1758+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1759+ self . store ( new_tv_index, mcdc_temp, align) ;
17971760 }
17981761}
0 commit comments