rust/src/test/mir-opt/bool_compare.opt3.InstCombine.diff
Matthew Jasper ff8c0ef0e4 Fix drop handling for if let expressions
MIR lowering for `if let` expressions is now more complicated now that
`if let` exists in HIR. This PR adds a scope for the variables bound in
an `if let` expression and then uses an approach similar to how we
handle loops to ensure that we reliably drop the correct variables.
2021-09-01 23:47:41 +01:00

35 lines
1.7 KiB
Diff

- // MIR for `opt3` before InstCombine
+ // MIR for `opt3` after InstCombine
fn opt3(_1: bool) -> u32 {
debug x => _1; // in scope 0 at $DIR/bool_compare.rs:12:9: 12:10
let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:12:21: 12:24
let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:13:8: 13:18
let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:13:8: 13:9
bb0: {
StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18
StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:13:8: 13:9
_3 = _1; // scope 0 at $DIR/bool_compare.rs:13:8: 13:9
- _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18
+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18
StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:13:17: 13:18
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:13:8: 13:18
}
bb1: {
_0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:13:21: 13:22
goto -> bb3; // scope 0 at $DIR/bool_compare.rs:13:5: 13:35
}
bb2: {
_0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:13:32: 13:33
goto -> bb3; // scope 0 at $DIR/bool_compare.rs:13:5: 13:35
}
bb3: {
StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:13:34: 13:35
return; // scope 0 at $DIR/bool_compare.rs:14:2: 14:2
}
}