| - // MIR for `array_bound_mut` before GVN | |
| + // MIR for `array_bound_mut` after GVN | |
| fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 { | |
| debug index => _1; | |
| debug slice => _2; | |
| let mut _0: u8; | |
| let mut _3: bool; | |
| let mut _4: usize; | |
| let mut _5: usize; | |
| let mut _6: &[u8]; | |
| let mut _7: &[u8; N]; | |
| let _8: usize; | |
| let mut _9: bool; | |
| let _10: usize; | |
| let mut _11: bool; | |
| bb0: { | |
| StorageLive(_3); | |
| StorageLive(_4); | |
| _4 = copy _1; | |
| StorageLive(_5); | |
| StorageLive(_6); | |
| StorageLive(_7); | |
| _7 = &(*_2); | |
| _6 = move _7 as &[u8] (PointerCoercion(Unsize, Implicit)); | |
| StorageDead(_7); | |
| - _5 = PtrMetadata(move _6); | |
| + _5 = const N; | |
| goto -> bb1; | |
| } | |
| bb1: { | |
| StorageDead(_6); | |
| - _3 = Lt(move _4, move _5); | |
| - switchInt(move _3) -> [0: bb4, otherwise: bb2]; | |
| + _3 = Lt(copy _1, const N); | |
| + switchInt(copy _3) -> [0: bb4, otherwise: bb2]; | |
| } | |
| bb2: { | |
| StorageDead(_5); | |
| StorageDead(_4); | |
| StorageLive(_8); | |
| _8 = copy _1; | |
| - _9 = Lt(copy _8, const N); | |
| - assert(move _9, "index out of bounds: the length is {} but the index is {}", const N, copy _8) -> [success: bb3, unwind continue]; | |
| + _9 = copy _3; | |
| + assert(copy _3, "index out of bounds: the length is {} but the index is {}", const N, copy _1) -> [success: bb3, unwind continue]; | |
| } | |
| bb3: { | |
| - _0 = copy (*_2)[_8]; | |
| + _0 = copy (*_2)[_1]; | |
| StorageDead(_8); | |
| goto -> bb6; | |
| } | |
| bb4: { | |
| StorageDead(_5); | |
| StorageDead(_4); | |
| StorageLive(_10); | |
| _10 = const 0_usize; | |
| - _11 = Lt(copy _10, const N); | |
| - assert(move _11, "index out of bounds: the length is {} but the index is {}", const N, copy _10) -> [success: bb5, unwind continue]; | |
| + _11 = Lt(const 0_usize, const N); | |
| + assert(move _11, "index out of bounds: the length is {} but the index is {}", const N, const 0_usize) -> [success: bb5, unwind continue]; | |
| } | |
| bb5: { | |
| - (*_2)[_10] = const 42_u8; | |
| + (*_2)[0 of 1] = const 42_u8; | |
| StorageDead(_10); | |
| _0 = const 42_u8; | |
| goto -> bb6; | |
| } | |
| bb6: { | |
| StorageDead(_3); | |
| return; | |
| } | |
| } | |