rust/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff
Zalathar ee7dc06cf1 coverage: Store BCB node IDs in mappings, and resolve them in codegen
Even though the coverage graph itself is no longer available during codegen,
its nodes can still be used as opaque IDs.
2025-02-06 21:44:29 +11:00

136 lines
3.4 KiB
Diff

- // MIR for `main` before InstrumentCoverage
+ // MIR for `main` after InstrumentCoverage
fn main() -> () {
let mut _0: ();
let mut _1: Enum;
let mut _2: isize;
let _3: u32;
let mut _4: u32;
let _5: u32;
let mut _6: u32;
let _7: u32;
let mut _8: u32;
let _9: u32;
let mut _10: u32;
scope 1 {
debug d => _3;
}
scope 2 {
debug c => _5;
}
scope 3 {
debug b => _7;
}
scope 4 {
debug a => _9;
}
+ coverage body span: $DIR/branch_match_arms.rs:14:11: 21:2 (#0)
+ coverage ExpressionId(0) => Expression { lhs: Counter(1), op: Add, rhs: Counter(2) };
+ coverage ExpressionId(1) => Expression { lhs: Expression(0), op: Add, rhs: Counter(3) };
+ coverage ExpressionId(2) => Expression { lhs: Counter(0), op: Subtract, rhs: Expression(1) };
+ coverage Code { bcb: bcb0 } => $DIR/branch_match_arms.rs:14:1: 15:21 (#0);
+ coverage Code { bcb: bcb1 } => $DIR/branch_match_arms.rs:16:17: 16:33 (#0);
+ coverage Code { bcb: bcb3 } => $DIR/branch_match_arms.rs:17:17: 17:33 (#0);
+ coverage Code { bcb: bcb4 } => $DIR/branch_match_arms.rs:18:17: 18:33 (#0);
+ coverage Code { bcb: bcb5 } => $DIR/branch_match_arms.rs:19:17: 19:33 (#0);
+ coverage Code { bcb: bcb2 } => $DIR/branch_match_arms.rs:21:2: 21:2 (#0);
+
bb0: {
+ Coverage::CounterIncrement(0);
StorageLive(_1);
_1 = Enum::A(const 0_u32);
PlaceMention(_1);
_2 = discriminant(_1);
switchInt(move _2) -> [0: bb5, 1: bb4, 2: bb3, 3: bb2, otherwise: bb1];
}
bb1: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb2: {
+ Coverage::CounterIncrement(1);
falseEdge -> [real: bb8, imaginary: bb3];
}
bb3: {
+ Coverage::CounterIncrement(2);
falseEdge -> [real: bb7, imaginary: bb4];
}
bb4: {
+ Coverage::CounterIncrement(3);
falseEdge -> [real: bb6, imaginary: bb5];
}
bb5: {
+ Coverage::ExpressionUsed(2);
StorageLive(_9);
_9 = copy ((_1 as A).0: u32);
StorageLive(_10);
_10 = copy _9;
_0 = consume(move _10) -> [return: bb12, unwind: bb14];
}
bb6: {
StorageLive(_7);
_7 = copy ((_1 as B).0: u32);
StorageLive(_8);
_8 = copy _7;
_0 = consume(move _8) -> [return: bb11, unwind: bb14];
}
bb7: {
StorageLive(_5);
_5 = copy ((_1 as C).0: u32);
StorageLive(_6);
_6 = copy _5;
_0 = consume(move _6) -> [return: bb10, unwind: bb14];
}
bb8: {
StorageLive(_3);
_3 = copy ((_1 as D).0: u32);
StorageLive(_4);
_4 = copy _3;
_0 = consume(move _4) -> [return: bb9, unwind: bb14];
}
bb9: {
StorageDead(_4);
StorageDead(_3);
goto -> bb13;
}
bb10: {
StorageDead(_6);
StorageDead(_5);
goto -> bb13;
}
bb11: {
StorageDead(_8);
StorageDead(_7);
goto -> bb13;
}
bb12: {
StorageDead(_10);
StorageDead(_9);
goto -> bb13;
}
bb13: {
StorageDead(_1);
return;
}
bb14 (cleanup): {
resume;
}
}