2023-03-20 13:05:07 -05:00
|
|
|
- // MIR for `arithmetic_checked` before GVN
|
|
|
|
+ // MIR for `arithmetic_checked` after GVN
|
|
|
|
|
|
|
|
fn arithmetic_checked(_1: u64) -> () {
|
|
|
|
debug x => _1;
|
|
|
|
let mut _0: ();
|
|
|
|
let _2: ();
|
|
|
|
let mut _3: u64;
|
|
|
|
let mut _4: u64;
|
|
|
|
let mut _5: (u64, bool);
|
|
|
|
let _6: ();
|
|
|
|
let mut _7: u64;
|
|
|
|
let mut _8: u64;
|
|
|
|
let mut _9: (u64, bool);
|
|
|
|
let _10: ();
|
|
|
|
let mut _11: u64;
|
|
|
|
let mut _12: u64;
|
2023-03-20 16:37:36 -05:00
|
|
|
let mut _13: u64;
|
|
|
|
let mut _14: (u64, bool);
|
|
|
|
let _15: ();
|
2023-03-20 13:05:07 -05:00
|
|
|
let mut _16: u64;
|
2023-03-20 16:37:36 -05:00
|
|
|
let mut _17: u64;
|
|
|
|
let mut _18: (u64, bool);
|
|
|
|
let _19: ();
|
|
|
|
let mut _20: u64;
|
|
|
|
let mut _21: u64;
|
|
|
|
let mut _22: (u64, bool);
|
2023-03-20 13:05:07 -05:00
|
|
|
|
|
|
|
bb0: {
|
|
|
|
StorageLive(_2);
|
|
|
|
StorageLive(_3);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageLive(_4);
|
|
|
|
_4 = copy _1;
|
2024-05-16 04:07:31 -05:00
|
|
|
- _5 = AddWithOverflow(copy _4, const 0_u64);
|
2023-03-20 13:05:07 -05:00
|
|
|
- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind continue];
|
2024-05-16 04:07:31 -05:00
|
|
|
+ _5 = AddWithOverflow(copy _1, const 0_u64);
|
2023-03-20 16:37:36 -05:00
|
|
|
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", copy _1, const 0_u64) -> [success: bb1, unwind continue];
|
2023-03-20 13:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb1: {
|
2023-03-20 16:37:36 -05:00
|
|
|
- _3 = move (_5.0: u64);
|
|
|
|
+ _3 = copy _1;
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageDead(_4);
|
2023-03-20 16:37:36 -05:00
|
|
|
- _2 = opaque::<u64>(move _3) -> [return: bb2, unwind continue];
|
|
|
|
+ _2 = opaque::<u64>(copy _1) -> [return: bb2, unwind continue];
|
2023-03-20 13:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb2: {
|
|
|
|
StorageDead(_3);
|
|
|
|
StorageDead(_2);
|
|
|
|
StorageLive(_6);
|
|
|
|
StorageLive(_7);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageLive(_8);
|
|
|
|
_8 = copy _1;
|
2024-05-16 04:07:31 -05:00
|
|
|
- _9 = SubWithOverflow(copy _8, const 0_u64);
|
2023-03-20 13:05:07 -05:00
|
|
|
- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind continue];
|
2023-03-20 16:37:36 -05:00
|
|
|
+ _9 = copy _5;
|
|
|
|
+ assert(!const false, "attempt to compute `{} - {}`, which would overflow", copy _1, const 0_u64) -> [success: bb3, unwind continue];
|
2023-03-20 13:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb3: {
|
2023-03-20 16:37:36 -05:00
|
|
|
- _7 = move (_9.0: u64);
|
|
|
|
+ _7 = copy _1;
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageDead(_8);
|
2023-03-20 16:37:36 -05:00
|
|
|
- _6 = opaque::<u64>(move _7) -> [return: bb4, unwind continue];
|
|
|
|
+ _6 = opaque::<u64>(copy _1) -> [return: bb4, unwind continue];
|
2023-03-20 13:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb4: {
|
|
|
|
StorageDead(_7);
|
|
|
|
StorageDead(_6);
|
|
|
|
StorageLive(_10);
|
2023-03-20 16:37:36 -05:00
|
|
|
- StorageLive(_11);
|
|
|
|
+ nop;
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageLive(_12);
|
|
|
|
_12 = copy _1;
|
2023-03-20 16:37:36 -05:00
|
|
|
StorageLive(_13);
|
|
|
|
_13 = copy _1;
|
2024-05-16 04:07:31 -05:00
|
|
|
- _14 = SubWithOverflow(copy _12, copy _13);
|
2023-03-20 16:37:36 -05:00
|
|
|
- assert(!move (_14.1: bool), "attempt to compute `{} - {}`, which would overflow", move _12, move _13) -> [success: bb5, unwind continue];
|
|
|
|
+ _14 = const (0_u64, false);
|
|
|
|
+ assert(!const false, "attempt to compute `{} - {}`, which would overflow", copy _1, copy _1) -> [success: bb5, unwind continue];
|
2023-03-20 13:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb5: {
|
2023-03-20 16:37:36 -05:00
|
|
|
- _11 = move (_14.0: u64);
|
|
|
|
+ _11 = const 0_u64;
|
|
|
|
StorageDead(_13);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageDead(_12);
|
2023-03-20 16:37:36 -05:00
|
|
|
- _10 = opaque::<u64>(move _11) -> [return: bb6, unwind continue];
|
|
|
|
+ _10 = opaque::<u64>(const 0_u64) -> [return: bb6, unwind continue];
|
2023-03-20 13:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb6: {
|
2023-03-20 16:37:36 -05:00
|
|
|
- StorageDead(_11);
|
|
|
|
+ nop;
|
2023-03-20 13:05:07 -05:00
|
|
|
StorageDead(_10);
|
|
|
|
StorageLive(_15);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageLive(_16);
|
2023-03-20 16:37:36 -05:00
|
|
|
StorageLive(_17);
|
|
|
|
_17 = copy _1;
|
2024-05-16 04:07:31 -05:00
|
|
|
- _18 = MulWithOverflow(copy _17, const 0_u64);
|
2023-03-20 16:37:36 -05:00
|
|
|
- assert(!move (_18.1: bool), "attempt to compute `{} * {}`, which would overflow", move _17, const 0_u64) -> [success: bb7, unwind continue];
|
|
|
|
+ _18 = const (0_u64, false);
|
|
|
|
+ assert(!const false, "attempt to compute `{} * {}`, which would overflow", copy _1, const 0_u64) -> [success: bb7, unwind continue];
|
2023-03-20 13:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb7: {
|
2023-03-20 16:37:36 -05:00
|
|
|
- _16 = move (_18.0: u64);
|
|
|
|
+ _16 = const 0_u64;
|
|
|
|
StorageDead(_17);
|
|
|
|
- _15 = opaque::<u64>(move _16) -> [return: bb8, unwind continue];
|
|
|
|
+ _15 = opaque::<u64>(const 0_u64) -> [return: bb8, unwind continue];
|
2023-03-20 13:05:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb8: {
|
2023-03-20 16:37:36 -05:00
|
|
|
StorageDead(_16);
|
2023-03-20 13:05:07 -05:00
|
|
|
StorageDead(_15);
|
2023-03-20 16:37:36 -05:00
|
|
|
StorageLive(_19);
|
|
|
|
StorageLive(_20);
|
|
|
|
StorageLive(_21);
|
|
|
|
_21 = copy _1;
|
2024-05-16 04:07:31 -05:00
|
|
|
- _22 = MulWithOverflow(copy _21, const 1_u64);
|
2023-03-20 16:37:36 -05:00
|
|
|
- assert(!move (_22.1: bool), "attempt to compute `{} * {}`, which would overflow", move _21, const 1_u64) -> [success: bb9, unwind continue];
|
|
|
|
+ _22 = copy _5;
|
|
|
|
+ assert(!const false, "attempt to compute `{} * {}`, which would overflow", copy _1, const 1_u64) -> [success: bb9, unwind continue];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb9: {
|
|
|
|
- _20 = move (_22.0: u64);
|
|
|
|
+ _20 = copy _1;
|
|
|
|
StorageDead(_21);
|
|
|
|
- _19 = opaque::<u64>(move _20) -> [return: bb10, unwind continue];
|
|
|
|
+ _19 = opaque::<u64>(copy _1) -> [return: bb10, unwind continue];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb10: {
|
|
|
|
StorageDead(_20);
|
|
|
|
StorageDead(_19);
|
2023-03-20 13:05:07 -05:00
|
|
|
_0 = const ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2024-06-14 18:05:22 -05:00
|
|
|
+
|
|
|
|
+ ALLOC0 (size: 16, align: 8) { .. }
|
2023-03-20 13:05:07 -05:00
|
|
|
|