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;
|
|
|
|
let mut _13: (u64, bool);
|
|
|
|
let _14: ();
|
|
|
|
let mut _15: u64;
|
|
|
|
let mut _16: u64;
|
|
|
|
let mut _17: (u64, bool);
|
|
|
|
|
|
|
|
bb0: {
|
|
|
|
StorageLive(_2);
|
|
|
|
StorageLive(_3);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageLive(_4);
|
|
|
|
_4 = _1;
|
2023-03-20 13:05:07 -05:00
|
|
|
- _5 = CheckedAdd(_4, const 0_u64);
|
|
|
|
- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind unreachable];
|
|
|
|
+ _5 = CheckedAdd(_1, const 0_u64);
|
|
|
|
+ assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", _1, const 0_u64) -> [success: bb1, unwind unreachable];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb1: {
|
|
|
|
_3 = move (_5.0: u64);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageDead(_4);
|
2023-03-20 13:05:07 -05:00
|
|
|
_2 = opaque::<u64>(move _3) -> [return: bb2, unwind unreachable];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb2: {
|
|
|
|
StorageDead(_3);
|
|
|
|
StorageDead(_2);
|
|
|
|
StorageLive(_6);
|
|
|
|
StorageLive(_7);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageLive(_8);
|
|
|
|
_8 = _1;
|
2023-03-20 13:05:07 -05:00
|
|
|
- _9 = CheckedSub(_8, const 0_u64);
|
|
|
|
- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind unreachable];
|
|
|
|
+ _9 = CheckedSub(_1, const 0_u64);
|
|
|
|
+ assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", _1, const 0_u64) -> [success: bb3, unwind unreachable];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb3: {
|
|
|
|
_7 = move (_9.0: u64);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageDead(_8);
|
2023-03-20 13:05:07 -05:00
|
|
|
_6 = opaque::<u64>(move _7) -> [return: bb4, unwind unreachable];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb4: {
|
|
|
|
StorageDead(_7);
|
|
|
|
StorageDead(_6);
|
|
|
|
StorageLive(_10);
|
|
|
|
StorageLive(_11);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageLive(_12);
|
|
|
|
_12 = _1;
|
2023-03-20 13:05:07 -05:00
|
|
|
- _13 = CheckedMul(_12, const 0_u64);
|
|
|
|
- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind unreachable];
|
|
|
|
+ _13 = CheckedMul(_1, const 0_u64);
|
|
|
|
+ assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 0_u64) -> [success: bb5, unwind unreachable];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb5: {
|
|
|
|
_11 = move (_13.0: u64);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageDead(_12);
|
2023-03-20 13:05:07 -05:00
|
|
|
_10 = opaque::<u64>(move _11) -> [return: bb6, unwind unreachable];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb6: {
|
|
|
|
StorageDead(_11);
|
|
|
|
StorageDead(_10);
|
|
|
|
StorageLive(_14);
|
|
|
|
StorageLive(_15);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageLive(_16);
|
|
|
|
_16 = _1;
|
2023-03-20 13:05:07 -05:00
|
|
|
- _17 = CheckedMul(_16, const 1_u64);
|
|
|
|
- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind unreachable];
|
|
|
|
+ _17 = CheckedMul(_1, const 1_u64);
|
|
|
|
+ assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", _1, const 1_u64) -> [success: bb7, unwind unreachable];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb7: {
|
|
|
|
_15 = move (_17.0: u64);
|
2023-09-16 12:13:30 -05:00
|
|
|
StorageDead(_16);
|
2023-03-20 13:05:07 -05:00
|
|
|
_14 = opaque::<u64>(move _15) -> [return: bb8, unwind unreachable];
|
|
|
|
}
|
|
|
|
|
|
|
|
bb8: {
|
|
|
|
StorageDead(_15);
|
|
|
|
StorageDead(_14);
|
|
|
|
_0 = const ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|