|
| 1 | +// MIR for `swap_generic` after PreCodegen |
| 2 | + |
| 3 | +fn swap_generic(_1: &mut T, _2: &mut T) -> () { |
| 4 | + debug a => _1; // in scope 0 at $DIR/mem_swap.rs:+0:28: +0:29 |
| 5 | + debug b => _2; // in scope 0 at $DIR/mem_swap.rs:+0:39: +0:40 |
| 6 | + let mut _0: (); // return place in scope 0 at $DIR/mem_swap.rs:+0:50: +0:50 |
| 7 | + let _3: (); // in scope 0 at $DIR/mem_swap.rs:+1:5: +1:25 |
| 8 | + scope 1 (inlined std::mem::swap::<T>) { // at $DIR/mem_swap.rs:14:5: 14:25 |
| 9 | + debug x => _1; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 10 | + debug y => _2; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 11 | + let mut _4: bool; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 12 | + let mut _5: usize; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 13 | + let mut _6: usize; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 14 | + let mut _7: usize; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 15 | + let mut _8: bool; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 16 | + let mut _9: *mut T; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 17 | + let mut _10: *mut T; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 18 | + scope 2 { |
| 19 | + } |
| 20 | + scope 3 (inlined std::mem::size_of::<T>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 21 | + } |
| 22 | + scope 4 (inlined align_of::<T>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 23 | + } |
| 24 | + scope 5 (inlined mem::swap_simple::<T>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 25 | + debug x => _1; // in scope 5 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 26 | + debug y => _2; // in scope 5 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 27 | + let mut _12: *const T; // in scope 5 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 28 | + let mut _14: *const T; // in scope 5 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 29 | + let mut _15: *mut T; // in scope 5 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 30 | + let mut _16: *mut T; // in scope 5 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 31 | + scope 6 { |
| 32 | + let _11: T; // in scope 6 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 33 | + scope 7 { |
| 34 | + debug a => _11; // in scope 7 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 35 | + let _13: T; // in scope 7 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 36 | + scope 8 { |
| 37 | + debug b => _13; // in scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 38 | + scope 15 (inlined std::ptr::write::<T>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 39 | + debug dst => _15; // in scope 15 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 40 | + debug src => _13; // in scope 15 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 41 | + let mut _19: *mut T; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 42 | + scope 16 { |
| 43 | + scope 17 (inlined std::ptr::write::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 44 | + debug dst => _19; // in scope 17 at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 45 | + } |
| 46 | + } |
| 47 | + } |
| 48 | + scope 18 (inlined std::ptr::write::<T>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 49 | + debug dst => _16; // in scope 18 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 50 | + debug src => _11; // in scope 18 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 51 | + let mut _20: *mut T; // in scope 18 at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 52 | + scope 19 { |
| 53 | + scope 20 (inlined std::ptr::write::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 54 | + debug dst => _20; // in scope 20 at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + scope 12 (inlined std::ptr::read::<T>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 60 | + debug src => _14; // in scope 12 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 61 | + let mut _18: *const T; // in scope 12 at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 62 | + scope 13 { |
| 63 | + scope 14 (inlined std::ptr::read::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 64 | + debug src => _18; // in scope 14 at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 65 | + } |
| 66 | + } |
| 67 | + } |
| 68 | + } |
| 69 | + scope 9 (inlined std::ptr::read::<T>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 70 | + debug src => _12; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 71 | + let mut _17: *const T; // in scope 9 at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 72 | + scope 10 { |
| 73 | + scope 11 (inlined std::ptr::read::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 74 | + debug src => _17; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + bb0: { |
| 83 | + StorageLive(_4); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 84 | + StorageLive(_5); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 85 | + StorageLive(_6); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 86 | + _6 = SizeOf(T); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 87 | + StorageLive(_7); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 88 | + _7 = AlignOf(T); // scope 4 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 89 | + _8 = Eq(_7, const 0_usize); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 90 | + assert(!move _8, "attempt to divide `{}` by zero", _6) -> bb2; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 91 | + } |
| 92 | + |
| 93 | + bb1: { |
| 94 | + return; // scope 0 at $DIR/mem_swap.rs:+2:2: +2:2 |
| 95 | + } |
| 96 | + |
| 97 | + bb2: { |
| 98 | + _5 = Div(move _6, move _7); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 99 | + StorageDead(_7); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 100 | + StorageDead(_6); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 101 | + _4 = Gt(move _5, const 4_usize); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 102 | + StorageDead(_5); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 103 | + switchInt(move _4) -> [0: bb5, otherwise: bb3]; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 104 | + } |
| 105 | + |
| 106 | + bb3: { |
| 107 | + StorageLive(_9); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 108 | + _9 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 109 | + StorageLive(_10); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 110 | + _10 = &raw mut (*_2); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 111 | + _3 = swap_nonoverlapping::<T>(move _9, move _10, const 1_usize) -> bb4; // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 112 | + // mir::Constant |
| 113 | + // + span: $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 114 | + // + literal: Const { ty: unsafe fn(*mut T, *mut T, usize) {swap_nonoverlapping::<T>}, val: Value(<ZST>) } |
| 115 | + } |
| 116 | + |
| 117 | + bb4: { |
| 118 | + StorageDead(_10); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 119 | + StorageDead(_9); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 120 | + StorageDead(_4); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 121 | + goto -> bb1; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 122 | + } |
| 123 | + |
| 124 | + bb5: { |
| 125 | + StorageDead(_4); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 126 | + StorageLive(_11); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 127 | + StorageLive(_13); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 128 | + StorageLive(_12); // scope 6 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 129 | + _12 = &raw const (*_1); // scope 6 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 130 | + StorageLive(_17); // scope 6 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 131 | + _11 = (*_12); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 132 | + StorageDead(_17); // scope 6 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 133 | + StorageDead(_12); // scope 6 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 134 | + StorageLive(_14); // scope 7 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 135 | + _14 = &raw const (*_2); // scope 7 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 136 | + StorageLive(_18); // scope 7 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 137 | + _13 = (*_14); // scope 13 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 138 | + StorageDead(_18); // scope 7 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 139 | + StorageDead(_14); // scope 7 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 140 | + StorageLive(_15); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 141 | + _15 = &raw mut (*_1); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 142 | + StorageLive(_19); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 143 | + (*_15) = move _13; // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 144 | + StorageDead(_19); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 145 | + StorageDead(_15); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 146 | + StorageLive(_16); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 147 | + _16 = &raw mut (*_2); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 148 | + StorageLive(_20); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 149 | + (*_16) = move _11; // scope 19 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL |
| 150 | + StorageDead(_20); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 151 | + StorageDead(_16); // scope 8 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 152 | + StorageDead(_13); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 153 | + StorageDead(_11); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 154 | + goto -> bb1; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL |
| 155 | + } |
| 156 | +} |
0 commit comments