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

147 lines
3.7 KiB
Rust
Raw Normal View History

2023-05-16 12:24:38 +00:00
// MIR for `range_loop` after PreCodegen
fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
2023-06-06 09:47:00 -04:00
debug slice => _1;
debug f => _2;
let mut _0: ();
let mut _3: usize;
2023-08-17 17:06:55 +00:00
let mut _4: std::ops::Range<usize>;
let mut _5: std::ops::Range<usize>;
let mut _9: std::option::Option<usize>;
let mut _12: isize;
let mut _14: usize;
let mut _15: bool;
let mut _17: &impl Fn(usize, &T);
let mut _18: (usize, &T);
let _19: ();
let mut _20: &mut std::ops::Range<usize>;
2023-05-16 12:24:38 +00:00
scope 1 {
2023-08-17 17:06:55 +00:00
debug iter => _5;
let _13: usize;
2023-05-16 12:24:38 +00:00
scope 2 {
2023-08-17 17:06:55 +00:00
debug i => _13;
let _16: &T;
2023-05-16 12:24:38 +00:00
scope 3 {
2023-08-17 17:06:55 +00:00
debug x => _16;
2023-05-16 12:24:38 +00:00
}
}
2023-06-06 09:47:00 -04:00
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
2023-08-17 17:06:55 +00:00
debug self => _20;
2023-06-06 09:47:00 -04:00
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
2023-08-17 17:06:55 +00:00
debug self => _20;
let mut _8: bool;
let _10: usize;
let mut _11: usize;
let mut _21: &usize;
let mut _22: &usize;
2023-06-01 06:08:25 +00:00
scope 7 {
2023-08-17 17:06:55 +00:00
debug old => _10;
2023-06-01 06:08:25 +00:00
scope 8 {
}
}
2023-06-06 09:47:00 -04:00
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
2023-08-17 17:06:55 +00:00
debug self => _21;
debug other => _22;
let mut _6: usize;
let mut _7: usize;
}
2023-06-01 06:08:25 +00:00
}
2023-05-16 12:24:38 +00:00
}
}
2023-06-06 09:47:00 -04:00
scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
2023-08-17 17:06:55 +00:00
debug self => _4;
2023-05-16 12:24:38 +00:00
}
bb0: {
2023-08-17 17:06:55 +00:00
StorageLive(_3);
2023-06-06 09:47:00 -04:00
_3 = Len((*_1));
2023-08-17 17:06:55 +00:00
_4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 };
StorageDead(_3);
StorageLive(_5);
_5 = move _4;
2023-06-06 09:47:00 -04:00
goto -> bb1;
2023-05-16 12:24:38 +00:00
}
bb1: {
2023-08-17 17:06:55 +00:00
StorageLive(_9);
StorageLive(_10);
2023-03-11 15:27:44 +00:00
StorageLive(_8);
2023-08-17 17:06:55 +00:00
StorageLive(_21);
StorageLive(_22);
2023-03-11 15:27:44 +00:00
StorageLive(_6);
2023-08-17 17:06:55 +00:00
_6 = (_5.0: usize);
StorageLive(_7);
_7 = (_5.1: usize);
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
2023-05-16 12:24:38 +00:00
}
bb2: {
2023-08-21 03:00:21 +08:00
StorageDead(_22);
StorageDead(_21);
2023-08-17 17:06:55 +00:00
_9 = Option::<usize>::None;
2023-06-06 09:47:00 -04:00
goto -> bb5;
2023-05-16 12:24:38 +00:00
}
bb3: {
2023-08-21 03:00:21 +08:00
StorageDead(_22);
StorageDead(_21);
2023-08-17 17:06:55 +00:00
_10 = (_5.0: usize);
StorageLive(_11);
_11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
2023-05-16 12:24:38 +00:00
}
bb4: {
2023-08-17 17:06:55 +00:00
(_5.0: usize) = move _11;
StorageDead(_11);
_9 = Option::<usize>::Some(_10);
2023-06-06 09:47:00 -04:00
goto -> bb5;
}
2023-05-16 12:24:38 +00:00
bb5: {
2023-03-11 15:27:44 +00:00
StorageDead(_8);
2023-08-17 17:06:55 +00:00
StorageDead(_10);
_12 = discriminant(_9);
switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
2023-05-16 12:24:38 +00:00
}
bb6: {
2023-08-17 17:06:55 +00:00
StorageDead(_9);
StorageDead(_5);
2023-06-06 09:47:00 -04:00
drop(_2) -> [return: bb7, unwind unreachable];
2023-06-01 06:08:25 +00:00
}
bb7: {
2023-06-06 09:47:00 -04:00
return;
2023-06-01 06:08:25 +00:00
}
bb8: {
2023-08-17 17:06:55 +00:00
_13 = ((_9 as Some).0: usize);
_14 = Len((*_1));
_15 = Lt(_13, _14);
assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind unreachable];
2023-06-01 06:08:25 +00:00
}
bb9: {
2023-08-17 17:06:55 +00:00
_16 = &(*_1)[_13];
StorageLive(_17);
_17 = &_2;
StorageLive(_18);
_18 = (_13, _16);
_19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind unreachable];
2023-05-16 12:24:38 +00:00
}
bb10: {
2023-08-17 17:06:55 +00:00
StorageDead(_18);
StorageDead(_17);
StorageDead(_9);
2023-06-06 09:47:00 -04:00
goto -> bb1;
2023-05-16 12:24:38 +00:00
}
bb11: {
2023-06-06 09:47:00 -04:00
unreachable;
2023-05-16 12:24:38 +00:00
}
}