rust/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
Scott McMurray b611b6bbb8 Replace NormalizeArrayLen with GVN
GVN is actually on in release, and covers all the same things (or more), with `LowerSliceLen` changed to produce `PtrMetadata`.
2024-06-20 22:16:59 -07:00

106 lines
2.7 KiB
Rust

// MIR for `range_loop` after PreCodegen
fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
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: ();
scope 1 {
debug ((iter: std::ops::Range<usize>).0: usize) => _4;
debug ((iter: std::ops::Range<usize>).1: usize) => _3;
let _10: usize;
scope 2 {
debug i => _10;
let _13: &T;
scope 3 {
debug x => _13;
}
}
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;
scope 7 {
}
scope 8 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
let mut _5: usize;
}
}
}
}
scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
}
bb0: {
_3 = PtrMetadata(_1);
StorageLive(_4);
_4 = const 0_usize;
goto -> bb1;
}
bb1: {
StorageLive(_9);
StorageLive(_7);
StorageLive(_6);
StorageLive(_5);
_5 = _4;
_6 = Lt(move _5, _3);
StorageDead(_5);
switchInt(move _6) -> [0: bb2, otherwise: bb4];
}
bb2: {
StorageDead(_6);
StorageDead(_7);
StorageDead(_9);
StorageDead(_4);
drop(_2) -> [return: bb3, unwind unreachable];
}
bb3: {
return;
}
bb4: {
_7 = _4;
StorageLive(_8);
_8 = <usize as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb5, unwind unreachable];
}
bb5: {
_4 = move _8;
StorageDead(_8);
_9 = Option::<usize>::Some(_7);
StorageDead(_6);
StorageDead(_7);
_10 = ((_9 as Some).0: usize);
_11 = Len((*_1));
_12 = Lt(_10, _11);
assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, _10) -> [success: bb6, unwind unreachable];
}
bb6: {
_13 = &(*_1)[_10];
StorageLive(_14);
_14 = &_2;
StorageLive(_15);
_15 = (_10, _13);
_16 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _14, move _15) -> [return: bb7, unwind unreachable];
}
bb7: {
StorageDead(_15);
StorageDead(_14);
StorageDead(_9);
goto -> bb1;
}
}