diff options
| author | The Miri Cronjob Bot <miri@cron.bot> | 2024-06-21 05:14:59 +0000 |
|---|---|---|
| committer | The Miri Cronjob Bot <miri@cron.bot> | 2024-06-21 05:14:59 +0000 |
| commit | 9d7de1fbdbf57b5d21e8a841c306e7d1f228ef37 (patch) | |
| tree | d62e86b319c4f189d03be09be1a3deb4b46a93fe /tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff | |
| parent | 121b06bd0593369477a70dfee156f10055ca7638 (diff) | |
| parent | 553a69030e5a086eb3841d020db8c9c463948c72 (diff) | |
Merge from rustc
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff')
| -rw-r--r-- | tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff new file mode 100644 index 00000000000..ed41703c873 --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff @@ -0,0 +1,71 @@ +- // MIR for `array_bound` before GVN ++ // MIR for `array_bound` after GVN + + fn array_bound(_1: usize, _2: &[u8; N]) -> u8 { + debug index => _1; + debug slice => _2; + let mut _0: u8; + let mut _3: bool; + let mut _4: usize; + let mut _5: usize; + let mut _6: &[u8]; + let mut _7: &[u8; N]; + let _8: usize; + let mut _9: usize; + let mut _10: bool; + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); + _7 = &(*_2); + _6 = move _7 as &[u8] (PointerCoercion(Unsize)); + StorageDead(_7); +- _5 = PtrMetadata(move _6); ++ _5 = const N; + goto -> bb1; + } + + bb1: { + StorageDead(_6); +- _3 = Lt(move _4, move _5); ++ _3 = Lt(_1, move _5); + switchInt(move _3) -> [0: bb4, otherwise: bb2]; + } + + bb2: { + StorageDead(_5); + StorageDead(_4); + StorageLive(_8); + _8 = _1; +- _9 = Len((*_2)); +- _10 = Lt(_8, _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue]; ++ _9 = const N; ++ _10 = Lt(_1, const N); ++ assert(move _10, "index out of bounds: the length is {} but the index is {}", const N, _1) -> [success: bb3, unwind continue]; + } + + bb3: { +- _0 = (*_2)[_8]; ++ _0 = (*_2)[_1]; + StorageDead(_8); + goto -> bb5; + } + + bb4: { + StorageDead(_5); + StorageDead(_4); + _0 = const 42_u8; + goto -> bb5; + } + + bb5: { + StorageDead(_3); + return; + } + } + |
