@@ -1679,9 +1679,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1679
1679
& mut self ,
1680
1680
fn_name : & ' ll Value ,
1681
1681
hash : & ' ll Value ,
1682
- bitmap_bytes : & ' ll Value ,
1682
+ bitmap_bits : & ' ll Value ,
1683
1683
) {
1684
- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1684
+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
1685
1685
1686
1686
assert ! (
1687
1687
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1693,7 +1693,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1693
1693
& [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
1694
1694
self . cx . type_void ( ) ,
1695
1695
) ;
1696
- let args = & [ fn_name, hash, bitmap_bytes ] ;
1696
+ let args = & [ fn_name, hash, bitmap_bits ] ;
1697
1697
let args = self . check_call ( "call" , llty, llfn, args) ;
1698
1698
1699
1699
unsafe {
@@ -1713,13 +1713,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1713
1713
& mut self ,
1714
1714
fn_name : & ' ll Value ,
1715
1715
hash : & ' ll Value ,
1716
- bitmap_bytes : & ' ll Value ,
1717
1716
bitmap_index : & ' ll Value ,
1718
1717
mcdc_temp : & ' ll Value ,
1719
1718
) {
1720
1719
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
1723
1722
) ;
1724
1723
assert ! (
1725
1724
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1729,16 +1728,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1729
1728
let llfn =
1730
1729
unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
1731
1730
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 ( ) ] ,
1739
1732
self . cx . type_void ( ) ,
1740
1733
) ;
1741
- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1734
+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
1742
1735
let args = self . check_call ( "call" , llty, llfn, args) ;
1743
1736
unsafe {
1744
1737
let _ = llvm:: LLVMRustBuildCall (
@@ -1754,45 +1747,15 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1754
1747
self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
1755
1748
}
1756
1749
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) ;
1769
1752
assert ! (
1770
1753
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
1771
1754
"MCDC intrinsics require LLVM 19 or later"
1772
1755
) ;
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) ;
1797
1760
}
1798
1761
}
0 commit comments