rust/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir

106 lines
2.8 KiB
Rust
Raw Normal View History

2023-05-16 07:24:38 -05:00
// MIR for `range_loop` after PreCodegen
fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
2023-06-06 08:47:00 -05:00
debug slice => _1;
debug f => _2;
let mut _0: ();
let mut _3: usize;
let mut _4: usize;
let mut _9: std::option::Option<usize>;
let mut _11: usize;
let mut _12: bool;
let mut _14: &impl Fn(usize, &T);
let mut _15: (usize, &T);
let _16: ();
2023-05-16 07:24:38 -05:00
scope 1 {
debug ((iter: std::ops::Range<usize>).0: usize) => _4;
debug ((iter: std::ops::Range<usize>).1: usize) => _3;
let _10: usize;
2023-05-16 07:24:38 -05:00
scope 2 {
debug i => _10;
let _13: &T;
2023-05-16 07:24:38 -05:00
scope 3 {
debug x => _13;
2023-05-16 07:24:38 -05:00
}
}
2023-06-06 08:47:00 -05:00
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
let mut _6: bool;
let _7: usize;
let mut _8: usize;
2023-06-01 01:08:25 -05:00
scope 7 {
}
scope 8 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
let mut _5: usize;
}
2023-06-01 01:08:25 -05:00
}
2023-05-16 07:24:38 -05:00
}
}
2023-06-06 08:47:00 -05:00
scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
2023-05-16 07:24:38 -05:00
}
bb0: {
2024-08-18 16:26:34 -05:00
_3 = PtrMetadata(copy _1);
StorageLive(_4);
_4 = const 0_usize;
2023-06-06 08:47:00 -05:00
goto -> bb1;
2023-05-16 07:24:38 -05:00
}
bb1: {
StorageLive(_9);
StorageLive(_7);
StorageLive(_6);
StorageLive(_5);
2024-08-18 16:26:34 -05:00
_5 = copy _4;
_6 = Lt(move _5, copy _3);
StorageDead(_5);
switchInt(move _6) -> [0: bb2, otherwise: bb4];
2023-05-16 07:24:38 -05:00
}
bb2: {
StorageDead(_6);
StorageDead(_7);
StorageDead(_9);
StorageDead(_4);
2023-01-18 11:57:50 -06:00
drop(_2) -> [return: bb3, unwind unreachable];
2023-05-16 07:24:38 -05:00
}
bb3: {
2023-01-18 11:57:50 -06:00
return;
2023-05-16 07:24:38 -05:00
}
bb4: {
2024-08-18 16:26:34 -05:00
_7 = copy _4;
StorageLive(_8);
2024-08-18 16:26:34 -05:00
_8 = <usize as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind unreachable];
}
2023-05-16 07:24:38 -05:00
bb5: {
_4 = move _8;
StorageDead(_8);
2024-08-18 16:26:34 -05:00
_9 = Option::<usize>::Some(copy _7);
StorageDead(_6);
StorageDead(_7);
2024-08-18 16:26:34 -05:00
_10 = copy ((_9 as Some).0: usize);
_11 = Len((*_1));
2024-08-18 16:26:34 -05:00
_12 = Lt(copy _10, copy _11);
assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, copy _10) -> [success: bb6, unwind unreachable];
2023-06-01 01:08:25 -05:00
}
2023-01-18 11:57:50 -06:00
bb6: {
_13 = &(*_1)[_10];
StorageLive(_14);
_14 = &_2;
StorageLive(_15);
2024-08-18 16:26:34 -05:00
_15 = (copy _10, copy _13);
_16 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _14, move _15) -> [return: bb7, unwind unreachable];
2023-05-16 07:24:38 -05:00
}
2023-01-18 11:57:50 -06:00
bb7: {
StorageDead(_15);
2023-01-18 11:57:50 -06:00
StorageDead(_14);
StorageDead(_9);
2023-06-06 08:47:00 -05:00
goto -> bb1;
2023-05-16 07:24:38 -05:00
}
2023-05-21 05:33:03 -05:00
}