2024-03-24 22:00:08 +11:00
|
|
|
// Test that `-C instrument-coverage` injects Coverage statements.
|
|
|
|
// The Coverage::CounterIncrement statements are later converted into LLVM
|
|
|
|
// instrprof.increment intrinsics, during codegen.
|
2020-06-10 09:54:02 -07:00
|
|
|
|
2024-04-20 13:19:34 +02:00
|
|
|
//@ test-mir-pass: InstrumentCoverage
|
2024-03-24 22:00:08 +11:00
|
|
|
//@ compile-flags: -Cinstrument-coverage -Zno-profiler-runtime
|
2020-10-05 16:36:10 -07:00
|
|
|
|
2020-07-27 21:22:43 +02:00
|
|
|
// EMIT_MIR instrument_coverage.main.InstrumentCoverage.diff
|
|
|
|
// EMIT_MIR instrument_coverage.bar.InstrumentCoverage.diff
|
2020-06-10 09:54:02 -07:00
|
|
|
fn main() {
|
|
|
|
loop {
|
|
|
|
if bar() {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline(never)]
|
|
|
|
fn bar() -> bool {
|
|
|
|
true
|
|
|
|
}
|
2020-08-01 20:03:59 -07:00
|
|
|
|
2024-03-24 22:00:08 +11:00
|
|
|
// CHECK: coverage ExpressionId({{[0-9]+}}) =>
|
|
|
|
// CHECK-DAG: coverage Code(Counter({{[0-9]+}})) =>
|
|
|
|
// CHECK-DAG: coverage Code(Expression({{[0-9]+}})) =>
|
|
|
|
// CHECK: bb0:
|
|
|
|
// CHECK-DAG: Coverage::ExpressionUsed({{[0-9]+}})
|
|
|
|
// CHECK-DAG: Coverage::CounterIncrement({{[0-9]+}})
|