granite-rust/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
2024-12-03 11:05:45 -08:00

76 lines
2.3 KiB
Diff

- // 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: bool;
let _9: ();
let mut _10: T;
let _11: usize;
let mut _12: bool;
scope 1 {
debug a => _3;
}
bb0: {
StorageLive(_3);
StorageLive(_4);
_4 = copy _1;
- _3 = [move _4; N];
+ _3 = [copy _1; N];
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
_7 = const 0_usize;
- _8 = Lt(copy _7, const N);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", const N, copy _7) -> [success: bb1, unwind unreachable];
+ _8 = Lt(const 0_usize, const N);
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", const N, const 0_usize) -> [success: bb1, unwind unreachable];
}
bb1: {
- _6 = copy _3[_7];
- _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
+ _6 = copy _1;
+ _5 = opaque::<T>(copy _1) -> [return: bb2, unwind unreachable];
}
bb2: {
StorageDead(_6);
StorageDead(_7);
StorageDead(_5);
StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
_11 = copy _2;
- _12 = Lt(copy _11, const N);
- assert(move _12, "index out of bounds: the length is {} but the index is {}", const N, copy _11) -> [success: bb3, unwind unreachable];
+ _12 = Lt(copy _2, const N);
+ assert(move _12, "index out of bounds: the length is {} but the index is {}", const N, copy _2) -> [success: bb3, unwind unreachable];
}
bb3: {
- _10 = copy _3[_11];
- _9 = opaque::<T>(move _10) -> [return: bb4, unwind unreachable];
+ _10 = copy _1;
+ _9 = opaque::<T>(copy _1) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_10);
StorageDead(_11);
StorageDead(_9);
_0 = const ();
StorageDead(_3);
return;
}
}