@@ -11,13 +11,12 @@ use rustc_codegen_ssa::traits::{
11
11
StaticMethods ,
12
12
} ;
13
13
use rustc_data_structures:: fx:: FxHashMap ;
14
- use rustc_hir:: def_id:: DefId ;
15
14
use rustc_llvm:: RustString ;
16
15
use rustc_middle:: bug;
17
- use rustc_middle:: mir:: coverage:: { CoverageKind , FunctionCoverageInfo } ;
16
+ use rustc_middle:: mir:: coverage:: CoverageKind ;
18
17
use rustc_middle:: mir:: Coverage ;
19
18
use rustc_middle:: ty:: layout:: HasTyCtxt ;
20
- use rustc_middle:: ty:: { self , GenericArgs , Instance , TyCtxt } ;
19
+ use rustc_middle:: ty:: Instance ;
21
20
22
21
use std:: cell:: RefCell ;
23
22
@@ -69,11 +68,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
69
68
bug ! ( "Could not get the `coverage_context`" ) ;
70
69
}
71
70
}
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
- }
77
71
}
78
72
79
73
impl < ' tcx > CoverageInfoBuilderMethods < ' tcx > for Builder < ' _ , ' _ , ' tcx > {
@@ -138,35 +132,6 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
138
132
}
139
133
}
140
134
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
-
170
135
/// Calls llvm::createPGOFuncNameVar() with the given function instance's
171
136
/// mangled function name. The LLVM API returns an llvm::GlobalVariable
172
137
/// containing the function name, with the specific variable name and linkage
0 commit comments