|
| 1 | +- // MIR for `main` before GVN |
| 2 | ++ // MIR for `main` after GVN |
| 3 | + |
| 4 | + fn main() -> () { |
| 5 | + let mut _0: (); |
| 6 | + let _1: std::alloc::Layout; |
| 7 | + let mut _2: std::option::Option<std::alloc::Layout>; |
| 8 | + let mut _3: *mut u8; |
| 9 | + let mut _4: *mut [u8]; |
| 10 | + let mut _5: std::ptr::NonNull<[u8]>; |
| 11 | + let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>; |
| 12 | + let mut _7: &std::alloc::Global; |
| 13 | + let mut _8: std::alloc::Layout; |
| 14 | + scope 1 { |
| 15 | + debug layout => _1; |
| 16 | + let mut _9: &std::alloc::Global; |
| 17 | + scope 2 { |
| 18 | + debug ptr => _3; |
| 19 | + } |
| 20 | + scope 5 (inlined <std::alloc::Global as Allocator>::allocate) { |
| 21 | + debug self => _9; |
| 22 | + debug layout => _1; |
| 23 | + } |
| 24 | + scope 6 (inlined #[track_caller] Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap) { |
| 25 | + debug self => _6; |
| 26 | + let mut _12: isize; |
| 27 | + let _13: std::alloc::AllocError; |
| 28 | + let mut _14: !; |
| 29 | + let _15: &str; |
| 30 | + let mut _16: &dyn std::fmt::Debug; |
| 31 | + let mut _17: &std::alloc::AllocError; |
| 32 | + scope 7 { |
| 33 | + debug t => _5; |
| 34 | + } |
| 35 | + scope 8 { |
| 36 | + debug e => const std::alloc::AllocError; |
| 37 | + } |
| 38 | + } |
| 39 | + scope 9 (inlined NonNull::<[u8]>::as_ptr) { |
| 40 | + debug self => _5; |
| 41 | + let mut _18: *const [u8]; |
| 42 | + } |
| 43 | + } |
| 44 | + scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) { |
| 45 | + debug self => _2; |
| 46 | + let mut _10: isize; |
| 47 | + let mut _11: !; |
| 48 | + scope 4 { |
| 49 | + debug val => _1; |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + bb0: { |
| 54 | + StorageLive(_2); |
| 55 | +- _2 = Option::<Layout>::None; |
| 56 | ++ _2 = const Option::<Layout>::None; |
| 57 | + StorageLive(_10); |
| 58 | + _10 = const 0_isize; |
| 59 | + switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; |
| 60 | + } |
| 61 | + |
| 62 | + bb1: { |
| 63 | + _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable; |
| 64 | + } |
| 65 | + |
| 66 | + bb2: { |
| 67 | + unreachable; |
| 68 | + } |
| 69 | + |
| 70 | + bb3: { |
| 71 | +- _1 = move ((_2 as Some).0: std::alloc::Layout); |
| 72 | ++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }}; |
| 73 | + StorageDead(_10); |
| 74 | + StorageDead(_2); |
| 75 | + StorageLive(_3); |
| 76 | + StorageLive(_4); |
| 77 | + StorageLive(_5); |
| 78 | + StorageLive(_6); |
| 79 | + _9 = const _; |
| 80 | +- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable]; |
| 81 | ++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb4, unwind unreachable]; |
| 82 | + } |
| 83 | + |
| 84 | + bb4: { |
| 85 | + StorageLive(_12); |
| 86 | + StorageLive(_15); |
| 87 | + _12 = discriminant(_6); |
| 88 | + switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb2]; |
| 89 | + } |
| 90 | + |
| 91 | + bb5: { |
| 92 | + _15 = const "called `Result::unwrap()` on an `Err` value"; |
| 93 | + StorageLive(_16); |
| 94 | + StorageLive(_17); |
| 95 | + _17 = &_13; |
| 96 | + _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); |
| 97 | + StorageDead(_17); |
| 98 | + _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable; |
| 99 | + } |
| 100 | + |
| 101 | + bb6: { |
| 102 | + _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>); |
| 103 | + StorageDead(_15); |
| 104 | + StorageDead(_12); |
| 105 | + StorageDead(_6); |
| 106 | + StorageLive(_18); |
| 107 | + _18 = (_5.0: *const [u8]); |
| 108 | + _4 = move _18 as *mut [u8] (PtrToPtr); |
| 109 | + StorageDead(_18); |
| 110 | + StorageDead(_5); |
| 111 | + _3 = move _4 as *mut u8 (PtrToPtr); |
| 112 | + StorageDead(_4); |
| 113 | + StorageDead(_3); |
| 114 | + return; |
| 115 | + } |
| 116 | + } |
| 117 | ++ |
| 118 | ++ ALLOC0 (size: 8, align: 4) { |
| 119 | ++ 00 00 00 00 __ __ __ __ │ ....░░░░ |
| 120 | ++ } |
| 121 | ++ |
| 122 | ++ ALLOC1 (size: 0, align: 1) {} |
| 123 | + |
0 commit comments