Rollup merge of #80521 - richkadel:llvm-coverage-counters-2.4.0, r=wesleywiser
MIR Inline is incompatible with coverage Fixes: #80060 Fixed by disabling inlining if `-Zinstrument-coverage` is set. The PR also adds additional use cases to the coverage test for doctests. r? `@wesleywiser` cc: `@tmandry`
This commit is contained in:
commit
3acd75dd25
7 changed files with 210 additions and 103 deletions
|
@ -41,6 +41,15 @@ impl<'tcx> MirPass<'tcx> for Inline {
|
|||
return;
|
||||
}
|
||||
|
||||
if tcx.sess.opts.debugging_opts.instrument_coverage {
|
||||
// Since `Inline` happens after `InstrumentCoverage`, the function-specific coverage
|
||||
// counters can be invalidated, such as by merging coverage counter statements from
|
||||
// a pre-inlined function into a different function. This kind of change is invalid,
|
||||
// so inlining must be skipped. Note: This check is performed here so inlining can
|
||||
// be disabled without preventing other optimizations (regardless of `mir_opt_level`).
|
||||
return;
|
||||
}
|
||||
|
||||
if inline(tcx, body) {
|
||||
debug!("running simplify cfg on {:?}", body.source);
|
||||
CfgSimplifier::new(body).simplify();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue