coverageinfo
query needs to use the same MIR as codegen
I ran into an error trying to fix dead block coverage and realized the `coverageinfo` query is getting a different MIR compared to the codegenned MIR, which can sometimes be a problem during mapgen. I changed that query to use the `InstandeDef` (which includes the generic parameter substitutions, prosibly specific to const params) instead of the `DefId` (without unknown/default const substitutions).
This commit is contained in:
parent
31f523ff94
commit
aed8ef5a4d
5 changed files with 8 additions and 19 deletions
|
@ -49,9 +49,9 @@ impl<'tcx> FunctionCoverage<'tcx> {
|
|||
}
|
||||
|
||||
fn create(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>, is_used: bool) -> Self {
|
||||
let coverageinfo = tcx.coverageinfo(instance.def_id());
|
||||
let coverageinfo = tcx.coverageinfo(instance.def);
|
||||
debug!(
|
||||
"FunctionCoverage::new(instance={:?}) has coverageinfo={:?}. is_used={}",
|
||||
"FunctionCoverage::create(instance={:?}) has coverageinfo={:?}. is_used={}",
|
||||
instance, coverageinfo, is_used
|
||||
);
|
||||
Self {
|
||||
|
|
|
@ -31,7 +31,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
bx.add_coverage_counter(instance, id, code_region);
|
||||
}
|
||||
|
||||
let coverageinfo = bx.tcx().coverageinfo(instance.def_id());
|
||||
let coverageinfo = bx.tcx().coverageinfo(instance.def);
|
||||
|
||||
let fn_name = bx.get_pgo_func_name_var(instance);
|
||||
let hash = bx.const_u64(function_source_hash);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue