@@ -1751,9 +1751,9 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1751
1751
& mut self ,
1752
1752
fn_name : & ' ll Value ,
1753
1753
hash : & ' ll Value ,
1754
- bitmap_bytes : & ' ll Value ,
1754
+ bitmap_bits : & ' ll Value ,
1755
1755
) {
1756
- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1756
+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
1757
1757
1758
1758
assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1759
1759
@@ -1762,7 +1762,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1762
1762
& [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
1763
1763
self . cx . type_void ( ) ,
1764
1764
) ;
1765
- let args = & [ fn_name, hash, bitmap_bytes ] ;
1765
+ let args = & [ fn_name, hash, bitmap_bits ] ;
1766
1766
let args = self . check_call ( "call" , llty, llfn, args) ;
1767
1767
1768
1768
unsafe {
@@ -1782,29 +1782,22 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1782
1782
& mut self ,
1783
1783
fn_name : & ' ll Value ,
1784
1784
hash : & ' ll Value ,
1785
- bitmap_bytes : & ' ll Value ,
1786
1785
bitmap_index : & ' ll Value ,
1787
1786
mcdc_temp : & ' ll Value ,
1788
1787
) {
1789
1788
debug ! (
1790
- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1791
- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1789
+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1790
+ fn_name, hash, bitmap_index, mcdc_temp
1792
1791
) ;
1793
1792
assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1794
1793
1795
1794
let llfn =
1796
1795
unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
1797
1796
let llty = self . cx . type_func (
1798
- & [
1799
- self . cx . type_ptr ( ) ,
1800
- self . cx . type_i64 ( ) ,
1801
- self . cx . type_i32 ( ) ,
1802
- self . cx . type_i32 ( ) ,
1803
- self . cx . type_ptr ( ) ,
1804
- ] ,
1797
+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
1805
1798
self . cx . type_void ( ) ,
1806
1799
) ;
1807
- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1800
+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
1808
1801
let args = self . check_call ( "call" , llty, llfn, args) ;
1809
1802
unsafe {
1810
1803
let _ = llvm:: LLVMRustBuildCall (
@@ -1820,42 +1813,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1820
1813
self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
1821
1814
}
1822
1815
1823
- pub ( crate ) fn mcdc_condbitmap_update (
1824
- & mut self ,
1825
- fn_name : & ' ll Value ,
1826
- hash : & ' ll Value ,
1827
- cond_loc : & ' ll Value ,
1828
- mcdc_temp : & ' ll Value ,
1829
- bool_value : & ' ll Value ,
1830
- ) {
1831
- debug ! (
1832
- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})" ,
1833
- fn_name, hash, cond_loc, mcdc_temp, bool_value
1834
- ) ;
1816
+ pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1817
+ debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
1835
1818
assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1836
- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1837
- let llty = self . cx . type_func (
1838
- & [
1839
- self . cx . type_ptr ( ) ,
1840
- self . cx . type_i64 ( ) ,
1841
- self . cx . type_i32 ( ) ,
1842
- self . cx . type_ptr ( ) ,
1843
- self . cx . type_i1 ( ) ,
1844
- ] ,
1845
- self . cx . type_void ( ) ,
1846
- ) ;
1847
- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1848
- self . check_call ( "call" , llty, llfn, args) ;
1849
- unsafe {
1850
- let _ = llvm:: LLVMRustBuildCall (
1851
- self . llbuilder ,
1852
- llty,
1853
- llfn,
1854
- args. as_ptr ( ) as * const & llvm:: Value ,
1855
- args. len ( ) as c_uint ,
1856
- [ ] . as_ptr ( ) ,
1857
- 0 as c_uint ,
1858
- ) ;
1859
- }
1819
+ let align = self . tcx . data_layout . i32_align . abi ;
1820
+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1821
+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1822
+ self . store ( new_tv_index, mcdc_temp, align) ;
1860
1823
}
1861
1824
}
0 commit comments