rust/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.6 KiB
Diff
Raw Normal View History

- // MIR for `main` before ConstProp
+ // MIR for `main` after ConstProp
fn main() -> () {
2023-06-06 08:47:00 -05:00
let mut _0: ();
let _1: i32;
let mut _3: i32;
let mut _4: bool;
let mut _5: bool;
let mut _6: bool;
let mut _7: bool;
scope 1 {
2023-06-06 08:47:00 -05:00
debug y => _1;
let _2: i32;
scope 2 {
2023-06-06 08:47:00 -05:00
debug _z => _2;
}
}
bb0: {
2023-06-06 08:47:00 -05:00
StorageLive(_1);
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
- _3 = _1;
- _4 = Eq(_3, const 0_i32);
2023-06-23 11:53:09 -05:00
- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind continue];
2023-06-06 08:47:00 -05:00
+ _3 = const 0_i32;
+ _4 = const true;
2023-06-23 11:53:09 -05:00
+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind continue];
}
bb1: {
2023-06-06 08:47:00 -05:00
- _5 = Eq(_3, const -1_i32);
- _6 = Eq(const 1_i32, const i32::MIN);
- _7 = BitAnd(move _5, move _6);
2023-06-23 11:53:09 -05:00
- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue];
2023-06-06 08:47:00 -05:00
+ _5 = const false;
+ _6 = const false;
+ _7 = const false;
2023-02-07 13:24:21 -06:00
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind continue];
}
bb2: {
2023-02-07 13:24:21 -06:00
- _2 = Div(const 1_i32, move _3);
+ _2 = Div(const 1_i32, const 0_i32);
2023-06-06 08:47:00 -05:00
StorageDead(_3);
_0 = const ();
StorageDead(_2);
StorageDead(_1);
return;
}
}