rust/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

130 lines
3.5 KiB
Diff
Raw Normal View History

2023-01-31 11:16:16 -06:00
- // MIR for `main` before CopyProp
+ // MIR for `main` after CopyProp
fn main() -> () {
2023-06-06 08:47:00 -05:00
let mut _0: ();
let mut _1: i32;
let mut _3: std::ops::Range<usize>;
let mut _4: std::ops::Range<usize>;
let mut _5: usize;
let mut _6: &[i32];
let mut _7: &[i32; 4];
let mut _9: ();
let _10: ();
let mut _11: std::option::Option<usize>;
let mut _12: &mut std::ops::Range<usize>;
let mut _13: &mut std::ops::Range<usize>;
let mut _14: isize;
let mut _15: !;
let mut _17: i32;
let _18: usize;
let mut _19: usize;
let mut _20: bool;
2023-01-31 11:16:16 -06:00
scope 1 {
2023-06-06 08:47:00 -05:00
debug sum => _1;
let _2: [i32; 4];
2023-01-31 11:16:16 -06:00
scope 2 {
2023-06-06 08:47:00 -05:00
debug a => _2;
let mut _8: std::ops::Range<usize>;
2023-01-31 11:16:16 -06:00
scope 3 {
2023-06-06 08:47:00 -05:00
debug iter => _8;
let _16: usize;
2023-01-31 11:16:16 -06:00
scope 4 {
2023-06-06 08:47:00 -05:00
debug i => _16;
2023-01-31 11:16:16 -06:00
}
}
}
}
bb0: {
2023-06-06 08:47:00 -05:00
StorageLive(_1);
_1 = const 0_i32;
StorageLive(_2);
_2 = [const 0_i32, const 10_i32, const 20_i32, const 30_i32];
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
_7 = &_2;
_6 = move _7 as &[i32] (Pointer(Unsize));
StorageDead(_7);
_5 = core::slice::<impl [i32]>::len(move _6) -> [return: bb1, unwind unreachable];
2023-01-31 11:16:16 -06:00
}
bb1: {
2023-06-06 08:47:00 -05:00
StorageDead(_6);
_4 = std::ops::Range::<usize> { start: const 0_usize, end: move _5 };
StorageDead(_5);
_3 = <std::ops::Range<usize> as IntoIterator>::into_iter(move _4) -> [return: bb2, unwind unreachable];
2023-01-31 11:16:16 -06:00
}
bb2: {
2023-06-06 08:47:00 -05:00
StorageDead(_4);
StorageLive(_8);
_8 = move _3;
goto -> bb3;
2023-01-31 11:16:16 -06:00
}
bb3: {
2023-06-06 08:47:00 -05:00
- StorageLive(_10);
StorageLive(_11);
StorageLive(_12);
StorageLive(_13);
_13 = &mut _8;
_12 = &mut (*_13);
_11 = <std::ops::Range<usize> as Iterator>::next(move _12) -> [return: bb4, unwind unreachable];
2023-01-31 11:16:16 -06:00
}
bb4: {
2023-06-06 08:47:00 -05:00
StorageDead(_12);
_14 = discriminant(_11);
switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6];
2023-01-31 11:16:16 -06:00
}
bb5: {
2023-06-06 08:47:00 -05:00
- StorageLive(_16);
_16 = ((_11 as Some).0: usize);
StorageLive(_17);
- StorageLive(_18);
- _18 = _16;
_19 = Len(_2);
- _20 = Lt(_18, _19);
- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> [success: bb8, unwind unreachable];
+ _20 = Lt(_16, _19);
+ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind unreachable];
2023-01-31 11:16:16 -06:00
}
bb6: {
2023-06-06 08:47:00 -05:00
unreachable;
2023-01-31 11:16:16 -06:00
}
bb7: {
2023-06-06 08:47:00 -05:00
_0 = const ();
StorageDead(_13);
StorageDead(_11);
- StorageDead(_10);
StorageDead(_8);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
return;
2023-01-31 11:16:16 -06:00
}
bb8: {
2023-06-06 08:47:00 -05:00
- _17 = _2[_18];
+ _17 = _2[_16];
_1 = Add(_1, move _17);
StorageDead(_17);
- StorageDead(_18);
- _10 = const ();
- StorageDead(_16);
StorageDead(_13);
StorageDead(_11);
- StorageDead(_10);
- _9 = const ();
goto -> bb3;
2023-01-31 11:16:16 -06:00
}
}