rust/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
Zalathar 3920e07f0b Make coverage counter IDs count up from 0, not 1
Operand types are now tracked explicitly, so there is no need to reserve ID 0
for the special always-zero counter.

As part of the renumbering, this change fixes an off-by-one error in the way
counters were counted by the `coverageinfo` query. As a result, functions
should now have exactly the number of counters they actually need, instead of
always having an extra counter that is never used.
2023-08-01 11:29:55 +10:00

49 lines
1.2 KiB
Diff

- // MIR for `main` before InstrumentCoverage
+ // MIR for `main` after InstrumentCoverage
fn main() -> () {
let mut _0: ();
let mut _1: ();
let mut _2: bool;
let mut _3: !;
bb0: {
+ Coverage::Counter(0) for /the/src/instrument_coverage.rs:11:1 - 11:11;
goto -> bb1;
}
bb1: {
+ Coverage::Expression(0) = Counter(0) + Counter(1) for /the/src/instrument_coverage.rs:12:5 - 13:17;
falseUnwind -> [real: bb2, unwind: bb6];
}
bb2: {
StorageLive(_2);
_2 = bar() -> [return: bb3, unwind: bb6];
}
bb3: {
switchInt(move _2) -> [0: bb5, otherwise: bb4];
}
bb4: {
+ Coverage::Expression(2) = Expression(1) + Zero for /the/src/instrument_coverage.rs:17:1 - 17:2;
+ Coverage::Expression(1) = Expression(0) - Counter(1) for /the/src/instrument_coverage.rs:14:13 - 14:18;
_0 = const ();
StorageDead(_2);
return;
}
bb5: {
+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:15:10 - 15:11;
_1 = const ();
StorageDead(_2);
goto -> bb1;
}
bb6 (cleanup): {
resume;
}
}