@@ -11,13 +11,12 @@ use rustc_codegen_ssa::traits::{
1111 StaticMethods ,
1212} ;
1313use rustc_data_structures:: fx:: FxHashMap ;
14- use rustc_hir:: def_id:: DefId ;
1514use rustc_llvm:: RustString ;
1615use rustc_middle:: bug;
17- use rustc_middle:: mir:: coverage:: { CoverageKind , FunctionCoverageInfo } ;
16+ use rustc_middle:: mir:: coverage:: CoverageKind ;
1817use rustc_middle:: mir:: Coverage ;
1918use rustc_middle:: ty:: layout:: HasTyCtxt ;
20- use rustc_middle:: ty:: { self , GenericArgs , Instance , TyCtxt } ;
19+ use rustc_middle:: ty:: Instance ;
2120
2221use std:: cell:: RefCell ;
2322
@@ -69,11 +68,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
6968 bug ! ( "Could not get the `coverage_context`" ) ;
7069 }
7170 }
72-
73- fn define_unused_fn ( & self , def_id : DefId , function_coverage_info : & ' tcx FunctionCoverageInfo ) {
74- let instance = declare_unused_fn ( self . tcx , def_id) ;
75- add_unused_function_coverage ( self , instance, function_coverage_info) ;
76- }
7771}
7872
7973impl < ' tcx > CoverageInfoBuilderMethods < ' tcx > for Builder < ' _ , ' _ , ' tcx > {
@@ -138,35 +132,6 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
138132 }
139133}
140134
141- fn declare_unused_fn < ' tcx > ( tcx : TyCtxt < ' tcx > , def_id : DefId ) -> Instance < ' tcx > {
142- Instance :: new (
143- def_id,
144- GenericArgs :: for_item ( tcx, def_id, |param, _| {
145- if let ty:: GenericParamDefKind :: Lifetime = param. kind {
146- tcx. lifetimes . re_erased . into ( )
147- } else {
148- tcx. mk_param_from_def ( param)
149- }
150- } ) ,
151- )
152- }
153-
154- fn add_unused_function_coverage < ' tcx > (
155- cx : & CodegenCx < ' _ , ' tcx > ,
156- instance : Instance < ' tcx > ,
157- function_coverage_info : & ' tcx FunctionCoverageInfo ,
158- ) {
159- // An unused function's mappings will automatically be rewritten to map to
160- // zero, because none of its counters/expressions are marked as seen.
161- let function_coverage = FunctionCoverage :: unused ( instance, function_coverage_info) ;
162-
163- if let Some ( coverage_context) = cx. coverage_context ( ) {
164- coverage_context. function_coverage_map . borrow_mut ( ) . insert ( instance, function_coverage) ;
165- } else {
166- bug ! ( "Could not get the `coverage_context`" ) ;
167- }
168- }
169-
170135/// Calls llvm::createPGOFuncNameVar() with the given function instance's
171136/// mangled function name. The LLVM API returns an llvm::GlobalVariable
172137/// containing the function name, with the specific variable name and linkage
0 commit comments