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:
Yuki Okushi 2021-01-08 02:06:03 +09:00 committed by GitHub
commit 3acd75dd25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 210 additions and 103 deletions

View file

@ -0,0 +1,21 @@
// Ensures -Zmir-opt-level=2 (specifically, inlining) is not allowed with -Zinstrument-coverage.
// Regression test for issue #80060.
//
// needs-profiler-support
// build-pass
// compile-flags: -Zmir-opt-level=2 -Zinstrument-coverage
#[inline(never)]
fn foo() {}
pub fn baz() {
bar();
}
#[inline(always)]
fn bar() {
foo();
}
fn main() {
bar();
}

View file

@ -0,0 +1,2 @@
warning: `-Z mir-opt-level=2` (or any level > 1) enables function inlining, which is incompatible with `-Z instrument-coverage`. Inlining will be disabled.