2023-03-20 18:05:07 +00:00
|
|
|
- // MIR for `repeated_index` before GVN
|
|
|
|
+ // MIR for `repeated_index` after GVN
|
|
|
|
|
|
|
|
fn repeated_index(_1: T, _2: usize) -> () {
|
|
|
|
debug x => _1;
|
|
|
|
debug idx => _2;
|
|
|
|
let mut _0: ();
|
|
|
|
let _3: [T; N];
|
|
|
|
let mut _4: T;
|
|
|
|
let _5: ();
|
|
|
|
let mut _6: T;
|
|
|
|
let _7: usize;
|
|
|
|
let mut _8: usize;
|
|
|
|
let mut _9: bool;
|
|
|
|
let _10: ();
|
|
|
|
let mut _11: T;
|
|
|
|
let _12: usize;
|
|
|
|
let mut _13: usize;
|
|
|
|
let mut _14: bool;
|
|
|
|
scope 1 {
|
|
|
|
debug a => _3;
|
|
|
|
}
|
|
|
|
|
|
|
|
bb0: {
|
|
|
|
StorageLive(_3);
|
2023-09-16 17:13:30 +00:00
|
|
|
StorageLive(_4);
|
|
|
|
_4 = _1;
|
2023-03-20 18:05:07 +00:00
|
|
|
- _3 = [move _4; N];
|
|
|
|
+ _3 = [_1; N];
|
2023-09-16 17:13:30 +00:00
|
|
|
StorageDead(_4);
|
2023-03-20 18:05:07 +00:00
|
|
|
StorageLive(_5);
|
|
|
|
StorageLive(_6);
|
|
|
|
StorageLive(_7);
|
|
|
|
_7 = const 0_usize;
|
|
|
|
_8 = Len(_3);
|
|
|
|
- _9 = Lt(_7, _8);
|
|
|
|
- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind continue];
|
|
|
|
+ _9 = Lt(const 0_usize, _8);
|
|
|
|
+ assert(move _9, "index out of bounds: the length is {} but the index is {}", _8, const 0_usize) -> [success: bb1, unwind continue];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb1: {
|
2023-09-16 09:16:04 +00:00
|
|
|
- _6 = _3[_7];
|
2023-09-16 09:36:16 +00:00
|
|
|
- _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
|
|
|
|
+ _6 = _1;
|
|
|
|
+ _5 = opaque::<T>(_1) -> [return: bb2, unwind continue];
|
2023-03-20 18:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bb2: {
|
|
|
|
StorageDead(_6);
|
|
|
|
StorageDead(_7);
|
|
|
|
StorageDead(_5);
|
|
|
|
StorageLive(_10);
|
|
|
|
StorageLive(_11);
|
|
|
|
StorageLive(_12);
|
|
|
|
_12 = _2;
|
|
|
|
- _13 = Len(_3);
|
|
|
|
- _14 = Lt(_12, _13);
|
|
|
|
- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind continue];
|
2023-09-16 17:13:30 +00:00
|
|
|
+ _13 = _8;
|
2023-03-20 18:05:07 +00:00
|
|
|
+ _14 = Lt(_2, _8);
|
|
|
|
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind continue];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb3: {
|
2023-09-16 09:16:04 +00:00
|
|
|
- _11 = _3[_12];
|
2023-09-16 09:36:16 +00:00
|
|
|
- _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue];
|
|
|
|
+ _11 = _1;
|
|
|
|
+ _10 = opaque::<T>(_1) -> [return: bb4, unwind continue];
|
2023-03-20 18:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bb4: {
|
|
|
|
StorageDead(_11);
|
|
|
|
StorageDead(_12);
|
|
|
|
StorageDead(_10);
|
|
|
|
_0 = const ();
|
|
|
|
StorageDead(_3);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|