rust/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
2023-09-01 04:01:54 +08:00

139 lines
3.3 KiB
Rust

// MIR for `forward_loop` after PreCodegen
fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
debug start => _1;
debug end => _2;
debug f => _3;
let mut _0: ();
let mut _4: std::ops::Range<u32>;
let mut _5: std::ops::Range<u32>;
let mut _9: std::option::Option<u32>;
let mut _12: isize;
let mut _14: &impl Fn(u32);
let mut _15: (u32,);
let _16: ();
let mut _17: &mut std::ops::Range<u32>;
scope 1 {
debug iter => _5;
let _13: u32;
scope 2 {
debug x => _13;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
debug self => _17;
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => _17;
let mut _8: bool;
let _10: u32;
let mut _11: u32;
let mut _18: &u32;
let mut _19: &u32;
scope 6 {
debug old => _10;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
debug self => _18;
debug other => _19;
let mut _6: u32;
let mut _7: u32;
}
}
}
}
scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) {
debug self => _4;
}
bb0: {
_4 = std::ops::Range::<u32> { start: _1, end: _2 };
StorageLive(_5);
_5 = move _4;
goto -> bb1;
}
bb1: {
StorageLive(_9);
StorageLive(_10);
StorageLive(_8);
StorageLive(_18);
StorageLive(_19);
StorageLive(_6);
_6 = (_5.0: u32);
StorageLive(_7);
_7 = (_5.1: u32);
_8 = Lt(move _6, move _7);
StorageDead(_7);
StorageDead(_6);
switchInt(move _8) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_19);
StorageDead(_18);
_9 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
StorageDead(_19);
StorageDead(_18);
_10 = (_5.0: u32);
StorageLive(_11);
_11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11];
}
bb4: {
(_5.0: u32) = move _11;
StorageDead(_11);
_9 = Option::<u32>::Some(_10);
goto -> bb5;
}
bb5: {
StorageDead(_8);
StorageDead(_10);
_12 = discriminant(_9);
switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
StorageDead(_9);
StorageDead(_5);
drop(_3) -> [return: bb7, unwind continue];
}
bb7: {
return;
}
bb8: {
_13 = ((_9 as Some).0: u32);
StorageLive(_14);
_14 = &_3;
StorageLive(_15);
_15 = (_13,);
_16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind: bb11];
}
bb9: {
StorageDead(_15);
StorageDead(_14);
StorageDead(_9);
goto -> bb1;
}
bb10: {
unreachable;
}
bb11 (cleanup): {
drop(_3) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
resume;
}
}