rust/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.diff
2023-02-18 21:35:02 +00:00

81 lines
5.4 KiB
Diff

- // MIR for `main` before DataflowConstProp
+ // MIR for `main` after DataflowConstProp
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/checked.rs:+0:11: +0:11
let _1: i32; // in scope 0 at $DIR/checked.rs:+1:9: +1:10
let mut _4: i32; // in scope 0 at $DIR/checked.rs:+3:13: +3:14
let mut _5: i32; // in scope 0 at $DIR/checked.rs:+3:17: +3:18
let mut _6: (i32, bool); // in scope 0 at $DIR/checked.rs:+3:13: +3:18
let mut _9: i32; // in scope 0 at $DIR/checked.rs:+6:13: +6:14
let mut _10: (i32, bool); // in scope 0 at $DIR/checked.rs:+6:13: +6:18
scope 1 {
debug a => _1; // in scope 1 at $DIR/checked.rs:+1:9: +1:10
let _2: i32; // in scope 1 at $DIR/checked.rs:+2:9: +2:10
scope 2 {
debug b => _2; // in scope 2 at $DIR/checked.rs:+2:9: +2:10
let _3: i32; // in scope 2 at $DIR/checked.rs:+3:9: +3:10
scope 3 {
debug c => _3; // in scope 3 at $DIR/checked.rs:+3:9: +3:10
let _7: i32; // in scope 3 at $DIR/checked.rs:+5:9: +5:10
scope 4 {
debug d => _7; // in scope 4 at $DIR/checked.rs:+5:9: +5:10
let _8: i32; // in scope 4 at $DIR/checked.rs:+6:9: +6:10
scope 5 {
debug e => _8; // in scope 5 at $DIR/checked.rs:+6:9: +6:10
}
}
}
}
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/checked.rs:+1:9: +1:10
_1 = const 1_i32; // scope 0 at $DIR/checked.rs:+1:13: +1:14
StorageLive(_2); // scope 1 at $DIR/checked.rs:+2:9: +2:10
_2 = const 2_i32; // scope 1 at $DIR/checked.rs:+2:13: +2:14
StorageLive(_3); // scope 2 at $DIR/checked.rs:+3:9: +3:10
StorageLive(_4); // scope 2 at $DIR/checked.rs:+3:13: +3:14
- _4 = _1; // scope 2 at $DIR/checked.rs:+3:13: +3:14
+ _4 = const 1_i32; // scope 2 at $DIR/checked.rs:+3:13: +3:14
StorageLive(_5); // scope 2 at $DIR/checked.rs:+3:17: +3:18
- _5 = _2; // scope 2 at $DIR/checked.rs:+3:17: +3:18
- _6 = CheckedAdd(_4, _5); // scope 2 at $DIR/checked.rs:+3:13: +3:18
- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> bb1; // scope 2 at $DIR/checked.rs:+3:13: +3:18
+ _5 = const 2_i32; // scope 2 at $DIR/checked.rs:+3:17: +3:18
+ _6 = CheckedAdd(const 1_i32, const 2_i32); // scope 2 at $DIR/checked.rs:+3:13: +3:18
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> bb1; // scope 2 at $DIR/checked.rs:+3:13: +3:18
}
bb1: {
- _3 = move (_6.0: i32); // scope 2 at $DIR/checked.rs:+3:13: +3:18
+ _3 = const 3_i32; // scope 2 at $DIR/checked.rs:+3:13: +3:18
StorageDead(_5); // scope 2 at $DIR/checked.rs:+3:17: +3:18
StorageDead(_4); // scope 2 at $DIR/checked.rs:+3:17: +3:18
StorageLive(_7); // scope 3 at $DIR/checked.rs:+5:9: +5:10
_7 = const _; // scope 3 at $DIR/checked.rs:+5:13: +5:21
StorageLive(_8); // scope 4 at $DIR/checked.rs:+6:9: +6:10
StorageLive(_9); // scope 4 at $DIR/checked.rs:+6:13: +6:14
- _9 = _7; // scope 4 at $DIR/checked.rs:+6:13: +6:14
- _10 = CheckedAdd(_9, const 1_i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18
- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> bb2; // scope 4 at $DIR/checked.rs:+6:13: +6:18
+ _9 = const i32::MAX; // scope 4 at $DIR/checked.rs:+6:13: +6:14
+ _10 = CheckedAdd(const i32::MAX, const 1_i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> bb2; // scope 4 at $DIR/checked.rs:+6:13: +6:18
}
bb2: {
- _8 = move (_10.0: i32); // scope 4 at $DIR/checked.rs:+6:13: +6:18
+ _8 = const i32::MIN; // scope 4 at $DIR/checked.rs:+6:13: +6:18
StorageDead(_9); // scope 4 at $DIR/checked.rs:+6:17: +6:18
_0 = const (); // scope 0 at $DIR/checked.rs:+0:11: +7:2
StorageDead(_8); // scope 4 at $DIR/checked.rs:+7:1: +7:2
StorageDead(_7); // scope 3 at $DIR/checked.rs:+7:1: +7:2
StorageDead(_3); // scope 2 at $DIR/checked.rs:+7:1: +7:2
StorageDead(_2); // scope 1 at $DIR/checked.rs:+7:1: +7:2
StorageDead(_1); // scope 0 at $DIR/checked.rs:+7:1: +7:2
return; // scope 0 at $DIR/checked.rs:+7:2: +7:2
}
}