rust/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff
2023-06-15 15:19:11 -04:00

136 lines
4.2 KiB
Diff

- // MIR for `unchecked_shl_unsigned_smaller` before Inline
+ // MIR for `unchecked_shl_unsigned_smaller` after Inline
fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
debug a => _1;
debug b => _2;
let mut _0: u16;
let mut _3: u16;
let mut _4: u32;
+ scope 1 (inlined core::num::<impl u16>::unchecked_shl) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: u16;
+ scope 2 {
+ scope 3 (inlined core::num::<impl u16>::unchecked_shl::conv) {
+ debug x => _4;
+ let mut _6: std::option::Option<u16>;
+ let mut _7: std::result::Result<u16, std::num::TryFromIntError>;
+ scope 4 {
+ scope 5 (inlined <u32 as TryInto<u16>>::try_into) {
+ debug self => _4;
+ scope 6 (inlined convert::num::<impl TryFrom<u32> for u16>::try_from) {
+ debug u => _4;
+ let mut _8: bool;
+ let mut _9: u32;
+ let mut _10: u16;
+ }
+ }
+ scope 7 (inlined Result::<u16, TryFromIntError>::ok) {
+ debug self => _7;
+ let mut _11: isize;
+ let _12: u16;
+ scope 8 {
+ debug x => _12;
+ }
+ }
+ scope 9 (inlined #[track_caller] Option::<u16>::unwrap_unchecked) {
+ debug self => _6;
+ let mut _13: &std::option::Option<u16>;
+ let mut _14: isize;
+ scope 10 {
+ debug val => _5;
+ }
+ scope 11 {
+ scope 13 (inlined unreachable_unchecked) {
+ scope 14 {
+ scope 15 (inlined unreachable_unchecked::runtime) {
+ }
+ }
+ }
+ }
+ scope 12 (inlined Option::<u16>::is_some) {
+ debug self => _13;
+ }
+ }
+ }
+ }
+ }
+ }
bb0: {
StorageLive(_3);
_3 = _1;
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> bb1;
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = const 65535_u32;
+ _8 = Gt(_4, move _9);
+ StorageDead(_9);
+ switchInt(move _8) -> [0: bb3, otherwise: bb2];
}
bb1: {
+ StorageDead(_5);
StorageDead(_4);
StorageDead(_3);
return;
+ }
+
+ bb2: {
+ _7 = Result::<u16, TryFromIntError>::Err(const TryFromIntError(()));
+ goto -> bb4;
+ }
+
+ bb3: {
+ StorageLive(_10);
+ _10 = _4 as u16 (IntToInt);
+ _7 = Result::<u16, TryFromIntError>::Ok(move _10);
+ StorageDead(_10);
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_8);
+ StorageLive(_12);
+ _11 = discriminant(_7);
+ switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6];
+ }
+
+ bb5: {
+ _6 = Option::<u16>::None;
+ goto -> bb8;
+ }
+
+ bb6: {
+ unreachable;
+ }
+
+ bb7: {
+ _12 = move ((_7 as Ok).0: u16);
+ _6 = Option::<u16>::Some(move _12);
+ goto -> bb8;
+ }
+
+ bb8: {
+ StorageDead(_12);
+ StorageDead(_7);
+ StorageLive(_13);
+ _14 = discriminant(_6);
+ switchInt(move _14) -> [1: bb9, otherwise: bb6];
+ }
+
+ bb9: {
+ _5 = move ((_6 as Some).0: u16);
+ StorageDead(_13);
+ StorageDead(_6);
+ _0 = unchecked_shl::<u16>(_3, move _5) -> [return: bb1, unwind unreachable];
}
}