@@ -1763,18 +1763,18 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1763
1763
& mut self ,
1764
1764
fn_name : & ' ll Value ,
1765
1765
hash : & ' ll Value ,
1766
- bitmap_bytes : & ' ll Value ,
1766
+ bitmap_bits : & ' ll Value ,
1767
1767
) {
1768
- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bytes ) ;
1768
+ debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits ) ;
1769
1769
1770
- assert ! ( llvm_util:: get_version( ) >= ( 18 , 0 , 0 ) , "MCDC intrinsics require LLVM 18 or later" ) ;
1770
+ assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1771
1771
1772
1772
let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCParametersIntrinsic ( self . cx ( ) . llmod ) } ;
1773
1773
let llty = self . cx . type_func (
1774
1774
& [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
1775
1775
self . cx . type_void ( ) ,
1776
1776
) ;
1777
- let args = & [ fn_name, hash, bitmap_bytes ] ;
1777
+ let args = & [ fn_name, hash, bitmap_bits ] ;
1778
1778
let args = self . check_call ( "call" , llty, llfn, args) ;
1779
1779
1780
1780
unsafe {
@@ -1794,29 +1794,22 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1794
1794
& mut self ,
1795
1795
fn_name : & ' ll Value ,
1796
1796
hash : & ' ll Value ,
1797
- bitmap_bytes : & ' ll Value ,
1798
1797
bitmap_index : & ' ll Value ,
1799
1798
mcdc_temp : & ' ll Value ,
1800
1799
) {
1801
1800
debug ! (
1802
- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?} )" ,
1803
- fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp
1801
+ "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1802
+ fn_name, hash, bitmap_index, mcdc_temp
1804
1803
) ;
1805
- assert ! ( llvm_util:: get_version( ) >= ( 18 , 0 , 0 ) , "MCDC intrinsics require LLVM 18 or later" ) ;
1804
+ assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1806
1805
1807
1806
let llfn =
1808
1807
unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
1809
1808
let llty = self . cx . type_func (
1810
- & [
1811
- self . cx . type_ptr ( ) ,
1812
- self . cx . type_i64 ( ) ,
1813
- self . cx . type_i32 ( ) ,
1814
- self . cx . type_i32 ( ) ,
1815
- self . cx . type_ptr ( ) ,
1816
- ] ,
1809
+ & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
1817
1810
self . cx . type_void ( ) ,
1818
1811
) ;
1819
- let args = & [ fn_name, hash, bitmap_bytes , bitmap_index, mcdc_temp] ;
1812
+ let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
1820
1813
let args = self . check_call ( "call" , llty, llfn, args) ;
1821
1814
unsafe {
1822
1815
let _ = llvm:: LLVMRustBuildCall (
@@ -1832,42 +1825,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1832
1825
self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
1833
1826
}
1834
1827
1835
- pub ( crate ) fn mcdc_condbitmap_update (
1836
- & mut self ,
1837
- fn_name : & ' ll Value ,
1838
- hash : & ' ll Value ,
1839
- cond_loc : & ' ll Value ,
1840
- mcdc_temp : & ' ll Value ,
1841
- bool_value : & ' ll Value ,
1842
- ) {
1843
- debug ! (
1844
- "mcdc_condbitmap_update() with args ({:?}, {:?}, {:?}, {:?}, {:?})" ,
1845
- fn_name, hash, cond_loc, mcdc_temp, bool_value
1846
- ) ;
1847
- assert ! ( llvm_util:: get_version( ) >= ( 18 , 0 , 0 ) , "MCDC intrinsics require LLVM 18 or later" ) ;
1848
- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCCondBitmapIntrinsic ( self . cx ( ) . llmod ) } ;
1849
- let llty = self . cx . type_func (
1850
- & [
1851
- self . cx . type_ptr ( ) ,
1852
- self . cx . type_i64 ( ) ,
1853
- self . cx . type_i32 ( ) ,
1854
- self . cx . type_ptr ( ) ,
1855
- self . cx . type_i1 ( ) ,
1856
- ] ,
1857
- self . cx . type_void ( ) ,
1858
- ) ;
1859
- let args = & [ fn_name, hash, cond_loc, mcdc_temp, bool_value] ;
1860
- self . check_call ( "call" , llty, llfn, args) ;
1861
- unsafe {
1862
- let _ = llvm:: LLVMRustBuildCall (
1863
- self . llbuilder ,
1864
- llty,
1865
- llfn,
1866
- args. as_ptr ( ) as * const & llvm:: Value ,
1867
- args. len ( ) as c_uint ,
1868
- [ ] . as_ptr ( ) ,
1869
- 0 as c_uint ,
1870
- ) ;
1871
- }
1828
+ pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1829
+ debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
1830
+ assert ! ( llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) , "MCDC intrinsics require LLVM 19 or later" ) ;
1831
+ let align = self . tcx . data_layout . i32_align . abi ;
1832
+ let current_tv_index = self . load ( self . cx . type_i32 ( ) , mcdc_temp, align) ;
1833
+ let new_tv_index = self . add ( current_tv_index, cond_index) ;
1834
+ self . store ( new_tv_index, mcdc_temp, align) ;
1872
1835
}
1873
1836
}
0 commit comments