rust/tests/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff

53 lines
1.2 KiB
Diff
Raw Normal View History

2020-04-04 12:15:01 -05:00
- // 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 _2: i32;
let mut _3: std::option::Option<bool>;
let mut _4: isize;
2020-04-04 12:15:01 -05:00
scope 1 {
2023-06-06 08:47:00 -05:00
debug x => _1;
2020-04-04 12:15:01 -05:00
}
2022-06-10 16:12:58 -05:00
scope 2 {
}
2020-04-04 12:15:01 -05:00
bb0: {
2023-06-06 08:47:00 -05:00
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
- _3 = Option::<bool>::Some(const true);
- _4 = discriminant(_3);
- switchInt(move _4) -> [1: bb1, otherwise: bb3];
+ _3 = const Option::<bool>::Some(true);
+ _4 = const 1_isize;
+ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3];
2020-04-04 12:15:01 -05:00
}
bb1: {
2023-06-06 08:47:00 -05:00
- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2];
+ switchInt(const true) -> [0: bb3, otherwise: bb2];
2020-04-04 12:15:01 -05:00
}
bb2: {
2023-06-06 08:47:00 -05:00
_2 = const 42_i32;
goto -> bb4;
2020-04-04 12:15:01 -05:00
}
bb3: {
2023-06-06 08:47:00 -05:00
_2 = const 10_i32;
goto -> bb4;
2020-04-04 12:15:01 -05:00
}
bb4: {
2023-06-06 08:47:00 -05:00
_1 = Add(move _2, const 0_i32);
StorageDead(_2);
StorageDead(_3);
_0 = const ();
StorageDead(_1);
return;
2020-04-04 12:15:01 -05:00
}
}