@@ -1698,9 +1698,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1698
1698
& mut self ,
1699
1699
fn_name : & ' ll Value ,
1700
1700
hash : & ' ll Value ,
1701
- bitmap_bytes : & ' ll Value ,
1701
+ bitmap_bits : & ' ll Value ,
1702
1702
) {
1703
- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1703
+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
1704
1704
1705
1705
assert ! (
1706
1706
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1712,7 +1712,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1712
1712
& [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
1713
1713
self . cx . type_void ( ) ,
1714
1714
) ;
1715
- let args = & [ fn_name, hash, bitmap_bytes ] ;
1715
+ let args = & [ fn_name, hash, bitmap_bits ] ;
1716
1716
let args = self . check_call ( "call" , llty, llfn, args) ;
1717
1717
1718
1718
unsafe {
@@ -1732,13 +1732,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1732
1732
& mut self ,
1733
1733
fn_name : & ' ll Value ,
1734
1734
hash : & ' ll Value ,
1735
- bitmap_bytes : & ' ll Value ,
1736
1735
bitmap_index : & ' ll Value ,
1737
1736
mcdc_temp : & ' ll Value ,
1738
1737
) {
1739
1738
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
1742
1741
) ;
1743
1742
assert ! (
1744
1743
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1748,16 +1747,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1748
1747
let llfn =
1749
1748
unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
1750
1749
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 ( ) ] ,
1758
1751
self . cx . type_void ( ) ,
1759
1752
) ;
1760
- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1753
+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
1761
1754
let args = self . check_call ( "call" , llty, llfn, args) ;
1762
1755
unsafe {
1763
1756
let _ = llvm:: LLVMRustBuildCall (
@@ -1773,45 +1766,15 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1773
1766
self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
1774
1767
}
1775
1768
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) ;
1788
1771
assert ! (
1789
1772
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
1790
1773
"MCDC intrinsics require LLVM 19 or later"
1791
1774
) ;
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) ;
1816
1779
}
1817
1780
}
0 commit comments