rust/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
Zalathar a7832b14b1 Make the success arms of if lhs || rhs meet up in a separate block
In the previous code, the success block of `lhs` would jump directly to the
success block of `rhs`. However, `rhs_success_block` could already contain
statements that are specific to the RHS, and the direct goto causes them to be
executed in the LHS success path as well.

This patch therefore creates a fresh block that the LHS and RHS success blocks
can both jump to.
2024-02-29 20:24:43 +11:00

217 lines
3.5 KiB
Rust

// MIR for `test_complex` after built
fn test_complex() -> () {
let mut _0: ();
let _1: ();
let mut _2: E;
let mut _3: isize;
let mut _4: bool;
let mut _5: bool;
let mut _6: u8;
let mut _7: Droppy;
let mut _8: bool;
let mut _9: u8;
let mut _10: Droppy;
let mut _11: bool;
let mut _12: E;
let mut _13: isize;
bb0: {
StorageLive(_1);
StorageLive(_2);
_2 = E::f() -> [return: bb1, unwind: bb38];
}
bb1: {
PlaceMention(_2);
_3 = discriminant(_2);
switchInt(move _3) -> [0: bb5, otherwise: bb3];
}
bb2: {
FakeRead(ForMatchedPlace(None), _2);
unreachable;
}
bb3: {
goto -> bb23;
}
bb4: {
goto -> bb2;
}
bb5: {
falseEdge -> [real: bb7, imaginary: bb3];
}
bb6: {
goto -> bb3;
}
bb7: {
StorageLive(_4);
_4 = always_true() -> [return: bb8, unwind: bb38];
}
bb8: {
switchInt(move _4) -> [0: bb10, otherwise: bb9];
}
bb9: {
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
_7 = Droppy(const 0_u8);
_6 = (_7.0: u8);
_5 = Gt(move _6, const 0_u8);
switchInt(move _5) -> [0: bb12, otherwise: bb11];
}
bb10: {
goto -> bb16;
}
bb11: {
drop(_7) -> [return: bb13, unwind: bb38];
}
bb12: {
goto -> bb14;
}
bb13: {
StorageDead(_7);
StorageDead(_6);
goto -> bb20;
}
bb14: {
drop(_7) -> [return: bb15, unwind: bb38];
}
bb15: {
StorageDead(_7);
StorageDead(_6);
goto -> bb16;
}
bb16: {
StorageLive(_8);
StorageLive(_9);
StorageLive(_10);
_10 = Droppy(const 1_u8);
_9 = (_10.0: u8);
_8 = Gt(move _9, const 1_u8);
switchInt(move _8) -> [0: bb18, otherwise: bb17];
}
bb17: {
drop(_10) -> [return: bb19, unwind: bb38];
}
bb18: {
goto -> bb21;
}
bb19: {
StorageDead(_10);
StorageDead(_9);
goto -> bb20;
}
bb20: {
_1 = const ();
goto -> bb24;
}
bb21: {
drop(_10) -> [return: bb22, unwind: bb38];
}
bb22: {
StorageDead(_10);
StorageDead(_9);
goto -> bb23;
}
bb23: {
_1 = const ();
goto -> bb24;
}
bb24: {
StorageDead(_8);
StorageDead(_5);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
StorageLive(_11);
_11 = always_true() -> [return: bb25, unwind: bb38];
}
bb25: {
switchInt(move _11) -> [0: bb27, otherwise: bb26];
}
bb26: {
goto -> bb36;
}
bb27: {
goto -> bb28;
}
bb28: {
StorageLive(_12);
_12 = E::f() -> [return: bb29, unwind: bb38];
}
bb29: {
PlaceMention(_12);
_13 = discriminant(_12);
switchInt(move _13) -> [1: bb33, otherwise: bb31];
}
bb30: {
FakeRead(ForMatchedPlace(None), _12);
unreachable;
}
bb31: {
goto -> bb36;
}
bb32: {
goto -> bb30;
}
bb33: {
falseEdge -> [real: bb35, imaginary: bb31];
}
bb34: {
goto -> bb31;
}
bb35: {
_0 = const ();
goto -> bb37;
}
bb36: {
_0 = const ();
goto -> bb37;
}
bb37: {
StorageDead(_11);
StorageDead(_12);
return;
}
bb38 (cleanup): {
resume;
}
}