@@ -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 ! (
1759
1759
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1765,7 +1765,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1765
1765
& [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
1766
1766
self . cx . type_void ( ) ,
1767
1767
) ;
1768
- let args = & [ fn_name, hash, bitmap_bytes ] ;
1768
+ let args = & [ fn_name, hash, bitmap_bits ] ;
1769
1769
let args = self . check_call ( "call" , llty, llfn, args) ;
1770
1770
1771
1771
unsafe {
@@ -1785,13 +1785,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1785
1785
& mut self ,
1786
1786
fn_name : & ' ll Value ,
1787
1787
hash : & ' ll Value ,
1788
- bitmap_bytes : & ' ll Value ,
1789
1788
bitmap_index : & ' ll Value ,
1790
1789
mcdc_temp : & ' ll Value ,
1791
1790
) {
1792
1791
debug ! (
1793
- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1794
- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1792
+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1793
+ fn_name, hash, bitmap_index, mcdc_temp
1795
1794
) ;
1796
1795
assert ! (
1797
1796
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
@@ -1801,16 +1800,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1801
1800
let llfn =
1802
1801
unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
1803
1802
let llty = self . cx . type_func (
1804
- & [
1805
- self . cx . type_ptr ( ) ,
1806
- self . cx . type_i64 ( ) ,
1807
- self . cx . type_i32 ( ) ,
1808
- self . cx . type_i32 ( ) ,
1809
- self . cx . type_ptr ( ) ,
1810
- ] ,
1803
+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
1811
1804
self . cx . type_void ( ) ,
1812
1805
) ;
1813
- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1806
+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
1814
1807
let args = self . check_call ( "call" , llty, llfn, args) ;
1815
1808
unsafe {
1816
1809
let _ = llvm:: LLVMRustBuildCall (
@@ -1826,45 +1819,15 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1826
1819
self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
1827
1820
}
1828
1821
1829
- pub ( crate ) fn mcdc_condbitmap_update (
1830
- & mut self ,
1831
- fn_name : & ' ll Value ,
1832
- hash : & ' ll Value ,
1833
- cond_loc : & ' ll Value ,
1834
- mcdc_temp : & ' ll Value ,
1835
- bool_value : & ' ll Value ,
1836
- ) {
1837
- debug ! (
1838
- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})" ,
1839
- fn_name, hash, cond_loc, mcdc_temp, bool_value
1840
- ) ;
1822
+ pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1823
+ debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
1841
1824
assert ! (
1842
1825
crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
1843
1826
"MCDC intrinsics require LLVM 19 or later"
1844
1827
) ;
1845
- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1846
- let llty = self . cx . type_func (
1847
- & [
1848
- self . cx . type_ptr ( ) ,
1849
- self . cx . type_i64 ( ) ,
1850
- self . cx . type_i32 ( ) ,
1851
- self . cx . type_ptr ( ) ,
1852
- self . cx . type_i1 ( ) ,
1853
- ] ,
1854
- self . cx . type_void ( ) ,
1855
- ) ;
1856
- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1857
- self . check_call ( "call" , llty, llfn, args) ;
1858
- unsafe {
1859
- let _ = llvm:: LLVMRustBuildCall (
1860
- self . llbuilder ,
1861
- llty,
1862
- llfn,
1863
- args. as_ptr ( ) as * const & llvm:: Value ,
1864
- args. len ( ) as c_uint ,
1865
- [ ] . as_ptr ( ) ,
1866
- 0 as c_uint ,
1867
- ) ;
1868
- }
1828
+ let align = self . tcx . data_layout . i32_align . abi ;
1829
+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1830
+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1831
+ self . store ( new_tv_index, mcdc_temp, align) ;
1869
1832
}
1870
1833
}
0 commit comments