os-rust/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff
Zalathar 996bdabc2a coverage: Remove unhelpful code for handling multiple files per function
Functions currently can't have mappings in multiple files, and if that ever
changes (e.g. to properly support expansion regions), this code will need to be
completely overhauled anyway.
2024-11-08 20:43:08 +11:00

139 lines
3.6 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 ExpressionId(3) => Expression { lhs: Counter(3), op: Add, rhs: Counter(2) };
+ coverage ExpressionId(4) => Expression { lhs: Expression(3), op: Add, rhs: Counter(1) };
+ coverage ExpressionId(5) => Expression { lhs: Expression(4), op: Add, rhs: Expression(2) };
+ coverage Code(Counter(0)) => 14:1 - 15:21;
+ coverage Code(Counter(3)) => 16:17 - 16:33;
+ coverage Code(Counter(2)) => 17:17 - 17:33;
+ coverage Code(Counter(1)) => 18:17 - 18:33;
+ coverage Code(Expression(2)) => 19:17 - 19:33;
+ coverage Code(Expression(5)) => 21:1 - 21:2;
+
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(3);
falseEdge -> [real: bb8, imaginary: bb3];
}
bb3: {
+ Coverage::CounterIncrement(2);
falseEdge -> [real: bb7, imaginary: bb4];
}
bb4: {
+ Coverage::CounterIncrement(1);
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: {
+ Coverage::ExpressionUsed(5);
StorageDead(_1);
return;
}
bb14 (cleanup): {
resume;
}
}