@@ -1654,80 +1654,43 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
16541654 ///
16551655 /// [`CodeGenPGO::emitMCDCParameters`]:
16561656 /// https://github.com/rust-lang/llvm-project/blob/5399a24/clang/lib/CodeGen/CodeGenPGO.cpp#L1124
1657+ #[ instrument( level = "debug" , skip( self ) ) ]
16571658 pub ( crate ) fn mcdc_parameters (
16581659 & mut self ,
16591660 fn_name : & ' ll Value ,
16601661 hash : & ' ll Value ,
16611662 bitmap_bits : & ' ll Value ,
16621663 ) {
1663- debug ! ( "mcdc_parameters() with args ({:?}, {:?}, {:?})" , fn_name, hash, bitmap_bits) ;
1664-
16651664 assert ! (
16661665 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
16671666 "MCDC intrinsics require LLVM 19 or later"
16681667 ) ;
1669-
1670- let llfn = unsafe { llvm:: LLVMRustGetInstrProfMCDCParametersIntrinsic ( self . cx ( ) . llmod ) } ;
1671- let llty = self . cx . type_func (
1672- & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) ] ,
1673- self . cx . type_void ( ) ,
1674- ) ;
1675- let args = & [ fn_name, hash, bitmap_bits] ;
1676- let args = self . check_call ( "call" , llty, llfn, args) ;
1677-
1678- unsafe {
1679- let _ = llvm:: LLVMRustBuildCall (
1680- self . llbuilder ,
1681- llty,
1682- llfn,
1683- args. as_ptr ( ) as * const & llvm:: Value ,
1684- args. len ( ) as c_uint ,
1685- [ ] . as_ptr ( ) ,
1686- 0 as c_uint ,
1687- ) ;
1688- }
1668+ self . call_intrinsic ( "llvm.instrprof.mcdc.parameters" , & [ fn_name, hash, bitmap_bits] ) ;
16891669 }
16901670
1671+ #[ instrument( level = "debug" , skip( self ) ) ]
16911672 pub ( crate ) fn mcdc_tvbitmap_update (
16921673 & mut self ,
16931674 fn_name : & ' ll Value ,
16941675 hash : & ' ll Value ,
16951676 bitmap_index : & ' ll Value ,
16961677 mcdc_temp : & ' ll Value ,
16971678 ) {
1698- debug ! (
1699- "mcdc_tvbitmap_update() with args ({:?}, {:?}, {:?}, {:?})" ,
1700- fn_name, hash, bitmap_index, mcdc_temp
1701- ) ;
17021679 assert ! (
17031680 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
17041681 "MCDC intrinsics require LLVM 19 or later"
17051682 ) ;
1706-
1707- let llfn =
1708- unsafe { llvm:: LLVMRustGetInstrProfMCDCTVBitmapUpdateIntrinsic ( self . cx ( ) . llmod ) } ;
1709- let llty = self . cx . type_func (
1710- & [ self . cx . type_ptr ( ) , self . cx . type_i64 ( ) , self . cx . type_i32 ( ) , self . cx . type_ptr ( ) ] ,
1711- self . cx . type_void ( ) ,
1712- ) ;
17131683 let args = & [ fn_name, hash, bitmap_index, mcdc_temp] ;
1714- let args = self . check_call ( "call" , llty, llfn, args) ;
1715- unsafe {
1716- let _ = llvm:: LLVMRustBuildCall (
1717- self . llbuilder ,
1718- llty,
1719- llfn,
1720- args. as_ptr ( ) as * const & llvm:: Value ,
1721- args. len ( ) as c_uint ,
1722- [ ] . as_ptr ( ) ,
1723- 0 as c_uint ,
1724- ) ;
1725- }
1684+ self . call_intrinsic ( "llvm.instrprof.mcdc.tvbitmap.update" , args) ;
1685+ }
1686+
1687+ #[ instrument( level = "debug" , skip( self ) ) ]
1688+ pub ( crate ) fn mcdc_condbitmap_reset ( & mut self , mcdc_temp : & ' ll Value ) {
17261689 self . store ( self . const_i32 ( 0 ) , mcdc_temp, self . tcx . data_layout . i32_align . abi ) ;
17271690 }
17281691
1692+ #[ instrument( level = "debug" , skip( self ) ) ]
17291693 pub ( crate ) fn mcdc_condbitmap_update ( & mut self , cond_index : & ' ll Value , mcdc_temp : & ' ll Value ) {
1730- debug ! ( "mcdc_condbitmap_update() with args ({:?}, {:?})" , cond_index, mcdc_temp) ;
17311694 assert ! (
17321695 crate :: llvm_util:: get_version( ) >= ( 19 , 0 , 0 ) ,
17331696 "MCDC intrinsics require LLVM 19 or later"
0 commit comments