@@ -1719,9 +1719,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1719
1719
& mut self ,
1720
1720
fn_name : & ' ll Value ,
1721
1721
hash : & ' ll Value ,
1722
- bitmap_bytes : & ' ll Value ,
1722
+ bitmap_bits : & ' ll Value ,
1723
1723
) {
1724
- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1724
+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
1725
1725
1726
1726
assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1727
1727
@@ -1730,7 +1730,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1730
1730
& [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
1731
1731
self . cx . type_void ( ) ,
1732
1732
) ;
1733
- let args = & [ fn_name, hash, bitmap_bytes ] ;
1733
+ let args = & [ fn_name, hash, bitmap_bits ] ;
1734
1734
let args = self . check_call ( "call" , llty, llfn, args) ;
1735
1735
1736
1736
unsafe {
@@ -1750,29 +1750,22 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1750
1750
& mut self ,
1751
1751
fn_name : & ' ll Value ,
1752
1752
hash : & ' ll Value ,
1753
- bitmap_bytes : & ' ll Value ,
1754
1753
bitmap_index : & ' ll Value ,
1755
1754
mcdc_temp : & ' ll Value ,
1756
1755
) {
1757
1756
debug ! (
1758
- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1759
- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1757
+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1758
+ fn_name, hash, bitmap_index, mcdc_temp
1760
1759
) ;
1761
1760
assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1762
1761
1763
1762
let llfn =
1764
1763
unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
1765
1764
let llty = self . cx . type_func (
1766
- & [
1767
- self . cx . type_ptr ( ) ,
1768
- self . cx . type_i64 ( ) ,
1769
- self . cx . type_i32 ( ) ,
1770
- self . cx . type_i32 ( ) ,
1771
- self . cx . type_ptr ( ) ,
1772
- ] ,
1765
+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
1773
1766
self . cx . type_void ( ) ,
1774
1767
) ;
1775
- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1768
+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
1776
1769
let args = self . check_call ( "call" , llty, llfn, args) ;
1777
1770
unsafe {
1778
1771
let _ = llvm:: LLVMRustBuildCall (
@@ -1792,38 +1785,17 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1792
1785
& mut self ,
1793
1786
fn_name : & ' ll Value ,
1794
1787
hash : & ' ll Value ,
1795
- cond_loc : & ' ll Value ,
1788
+ cond_index : & ' ll Value ,
1796
1789
mcdc_temp : & ' ll Value ,
1797
- bool_value : & ' ll Value ,
1798
1790
) {
1799
1791
debug ! (
1800
- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1801
- fn_name, hash, cond_loc , mcdc_temp, bool_value
1792
+ "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1793
+ fn_name, hash, cond_index , mcdc_temp
1802
1794
) ;
1803
1795
assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1804
- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1805
- let llty = self . cx . type_func (
1806
- & [
1807
- self . cx . type_ptr ( ) ,
1808
- self . cx . type_i64 ( ) ,
1809
- self . cx . type_i32 ( ) ,
1810
- self . cx . type_ptr ( ) ,
1811
- self . cx . type_i1 ( ) ,
1812
- ] ,
1813
- self . cx . type_void ( ) ,
1814
- ) ;
1815
- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1816
- self . check_call ( "call" , llty, llfn, args) ;
1817
- unsafe {
1818
- let _ = llvm:: LLVMRustBuildCall (
1819
- self . llbuilder ,
1820
- llty,
1821
- llfn,
1822
- args. as_ptr ( ) as * const & llvm:: Value ,
1823
- args. len ( ) as c_uint ,
1824
- [ ] . as_ptr ( ) ,
1825
- 0 as c_uint ,
1826
- ) ;
1827
- }
1796
+ let align = self . tcx . data_layout . i32_align . abi ;
1797
+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1798
+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1799
+ self . store ( new_tv_index, mcdc_temp, align) ;
1828
1800
}
1829
1801
}
0 commit comments