rust/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir

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

66 lines
1.3 KiB
Rust
Raw Normal View History

2022-07-13 13:13:07 -05:00
// MIR for `foo` after PreCodegen
fn foo(_1: Option<String>) -> i32 {
2023-06-06 08:47:00 -05:00
debug s => _1;
let mut _0: i32;
let mut _2: bool;
let mut _3: isize;
let mut _4: &std::string::String;
let mut _5: &str;
let mut _6: bool;
let _7: std::option::Option<std::string::String>;
2022-07-13 13:13:07 -05:00
scope 1 {
2023-06-06 08:47:00 -05:00
debug s => _7;
2022-07-13 13:13:07 -05:00
}
bb0: {
2023-06-06 08:47:00 -05:00
_2 = const false;
_2 = const true;
_3 = discriminant(_1);
switchInt(move _3) -> [1: bb1, otherwise: bb5];
2022-07-13 13:13:07 -05:00
}
bb1: {
2023-06-06 08:47:00 -05:00
_4 = &((_1 as Some).0: std::string::String);
_5 = <String as Deref>::deref(move _4) -> [return: bb2, unwind unreachable];
2022-07-13 13:13:07 -05:00
}
bb2: {
2023-06-06 08:47:00 -05:00
_6 = <str as PartialEq>::eq(_5, const "a") -> [return: bb3, unwind unreachable];
2022-07-13 13:13:07 -05:00
}
bb3: {
2023-06-06 08:47:00 -05:00
switchInt(move _6) -> [0: bb5, otherwise: bb4];
}
2022-07-13 13:13:07 -05:00
bb4: {
2023-06-06 08:47:00 -05:00
_0 = const 1234_i32;
goto -> bb7;
2022-07-13 13:13:07 -05:00
}
bb5: {
2023-06-06 08:47:00 -05:00
StorageLive(_7);
_2 = const false;
_7 = move _1;
_0 = const 4321_i32;
drop(_7) -> [return: bb6, unwind unreachable];
2022-07-13 13:13:07 -05:00
}
bb6: {
2023-06-06 08:47:00 -05:00
StorageDead(_7);
goto -> bb7;
2022-07-13 13:13:07 -05:00
}
bb7: {
2023-06-06 08:47:00 -05:00
switchInt(_2) -> [0: bb9, otherwise: bb8];
2022-07-13 13:13:07 -05:00
}
bb8: {
2023-06-06 08:47:00 -05:00
drop(_1) -> [return: bb9, unwind unreachable];
2022-07-13 13:13:07 -05:00
}
bb9: {
2023-06-06 08:47:00 -05:00
return;
2022-07-13 13:13:07 -05:00
}
}