rust/tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff
Zalathar 91aae58568 coverage: Clean up marker statements that aren't needed later
Some of the marker statements used by coverage are added during MIR building
for use by the InstrumentCoverage pass (during analysis), and are not needed
afterwards.
2024-03-22 20:20:41 +11:00

54 lines
1.7 KiB
Diff

- // MIR for `main` before InstrumentCoverage
+ // MIR for `main` after InstrumentCoverage
fn main() -> () {
let mut _0: ();
let mut _1: bool;
coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => /the/src/instrument_coverage_cleanup.rs:15:8: 15:36 (#0)
+ coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) };
+ coverage ExpressionId(1) => Expression { lhs: Counter(1), op: Add, rhs: Expression(0) };
+ coverage Code(Counter(0)) => /the/src/instrument_coverage_cleanup.rs:14:1 - 15:36;
+ coverage Code(Expression(0)) => /the/src/instrument_coverage_cleanup.rs:15:37 - 15:39;
+ coverage Code(Counter(1)) => /the/src/instrument_coverage_cleanup.rs:15:39 - 15:40;
+ coverage Code(Expression(1)) => /the/src/instrument_coverage_cleanup.rs:16:1 - 16:2;
+ coverage Branch { true_term: Expression(0), false_term: Counter(1) } => /the/src/instrument_coverage_cleanup.rs:15:8 - 15:36;
+
bb0: {
+ Coverage::CounterIncrement(0);
Coverage::SpanMarker;
StorageLive(_1);
_1 = std::hint::black_box::<bool>(const true) -> [return: bb1, unwind: bb5];
}
bb1: {
switchInt(move _1) -> [0: bb3, otherwise: bb2];
}
bb2: {
+ Coverage::CounterIncrement(1);
Coverage::BlockMarker(1);
_0 = const ();
goto -> bb4;
}
bb3: {
+ Coverage::ExpressionUsed(0);
Coverage::BlockMarker(0);
_0 = const ();
goto -> bb4;
}
bb4: {
+ Coverage::ExpressionUsed(1);
StorageDead(_1);
return;
}
bb5 (cleanup): {
resume;
}
}