| - // MIR for `two_unwrap_unchecked` before GVN | |
| + // MIR for `two_unwrap_unchecked` after GVN | |
| fn two_unwrap_unchecked(_1: &Option<i32>) -> i32 { | |
| debug v => _1; | |
| let mut _0: i32; | |
| let _2: i32; | |
| let mut _3: std::option::Option<i32>; | |
| let mut _5: std::option::Option<i32>; | |
| let mut _6: i32; | |
| let mut _7: i32; | |
| scope 1 { | |
| debug v1 => _2; | |
| let _4: i32; | |
| scope 2 { | |
| debug v2 => _4; | |
| } | |
| scope 8 (inlined #[track_caller] Option::<i32>::unwrap_unchecked) { | |
| let mut _9: isize; | |
| scope 9 { | |
| } | |
| scope 10 (inlined #[track_caller] unreachable_unchecked) { | |
| scope 11 (inlined core::ub_checks::check_language_ub) { | |
| scope 12 (inlined core::ub_checks::check_language_ub::runtime) { | |
| } | |
| } | |
| } | |
| } | |
| } | |
| scope 3 (inlined #[track_caller] Option::<i32>::unwrap_unchecked) { | |
| let mut _8: isize; | |
| scope 4 { | |
| } | |
| scope 5 (inlined #[track_caller] unreachable_unchecked) { | |
| scope 6 (inlined core::ub_checks::check_language_ub) { | |
| scope 7 (inlined core::ub_checks::check_language_ub::runtime) { | |
| } | |
| } | |
| } | |
| } | |
| bb0: { | |
| StorageLive(_2); | |
| - StorageLive(_3); | |
| + nop; | |
| _3 = copy (*_1); | |
| - StorageLive(_8); | |
| + nop; | |
| _8 = discriminant(_3); | |
| - switchInt(move _8) -> [0: bb2, 1: bb3, otherwise: bb1]; | |
| + switchInt(copy _8) -> [0: bb2, 1: bb3, otherwise: bb1]; | |
| } | |
| bb1: { | |
| unreachable; | |
| } | |
| bb2: { | |
| unreachable; | |
| } | |
| bb3: { | |
| - _2 = move ((_3 as Some).0: i32); | |
| - StorageDead(_8); | |
| - StorageDead(_3); | |
| + _2 = copy ((_3 as Some).0: i32); | |
| + nop; | |
| + nop; | |
| StorageLive(_4); | |
| StorageLive(_5); | |
| - _5 = copy (*_1); | |
| + _5 = copy _3; | |
| StorageLive(_9); | |
| - _9 = discriminant(_5); | |
| - switchInt(move _9) -> [0: bb4, 1: bb5, otherwise: bb1]; | |
| + _9 = copy _8; | |
| + switchInt(copy _8) -> [0: bb4, 1: bb5, otherwise: bb1]; | |
| } | |
| bb4: { | |
| unreachable; | |
| } | |
| bb5: { | |
| - _4 = move ((_5 as Some).0: i32); | |
| + _4 = copy _2; | |
| StorageDead(_9); | |
| StorageDead(_5); | |
| StorageLive(_6); | |
| _6 = copy _2; | |
| StorageLive(_7); | |
| - _7 = copy _4; | |
| - _0 = Add(move _6, move _7); | |
| + _7 = copy _2; | |
| + _0 = Add(copy _2, copy _2); | |
| StorageDead(_7); | |
| StorageDead(_6); | |
| StorageDead(_4); | |
| StorageDead(_2); | |
| return; | |
| } | |
| } | |