-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a MIR pre-codegen test for derived PartialOrd
- Loading branch information
Showing
2 changed files
with
291 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// skip-filecheck | ||
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 | ||
|
||
#![crate_type = "lib"] | ||
|
||
#[derive(PartialOrd, PartialEq)] | ||
pub struct MultiField(u64, char, i16); | ||
|
||
// EMIT_MIR derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir |
282 changes: 282 additions & 0 deletions
282
tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,282 @@ | ||
// MIR for `<impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp` after PreCodegen | ||
|
||
fn <impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option<std::cmp::Ordering> { | ||
debug self => _1; | ||
debug other => _2; | ||
let mut _0: std::option::Option<std::cmp::Ordering>; | ||
let mut _3: &u64; | ||
let mut _4: &u64; | ||
let mut _12: std::option::Option<std::cmp::Ordering>; | ||
let mut _13: isize; | ||
let mut _14: i8; | ||
let mut _15: &char; | ||
let mut _16: &char; | ||
let mut _24: std::option::Option<std::cmp::Ordering>; | ||
let mut _25: isize; | ||
let mut _26: i8; | ||
let mut _27: &i16; | ||
let mut _28: &i16; | ||
scope 1 { | ||
debug cmp => _24; | ||
} | ||
scope 2 { | ||
debug cmp => _12; | ||
} | ||
scope 3 (inlined cmp::impls::<impl PartialOrd for u64>::partial_cmp) { | ||
debug self => _3; | ||
debug other => _4; | ||
let mut _11: std::cmp::Ordering; | ||
scope 4 (inlined cmp::impls::<impl Ord for u64>::cmp) { | ||
debug self => _3; | ||
debug other => _4; | ||
let mut _5: u64; | ||
let mut _6: u64; | ||
let mut _7: bool; | ||
let mut _8: u64; | ||
let mut _9: u64; | ||
let mut _10: bool; | ||
} | ||
} | ||
scope 5 (inlined cmp::impls::<impl PartialOrd for char>::partial_cmp) { | ||
debug self => _15; | ||
debug other => _16; | ||
let mut _23: std::cmp::Ordering; | ||
scope 6 (inlined cmp::impls::<impl Ord for char>::cmp) { | ||
debug self => _15; | ||
debug other => _16; | ||
let mut _17: char; | ||
let mut _18: char; | ||
let mut _19: bool; | ||
let mut _20: char; | ||
let mut _21: char; | ||
let mut _22: bool; | ||
} | ||
} | ||
scope 7 (inlined cmp::impls::<impl PartialOrd for i16>::partial_cmp) { | ||
debug self => _27; | ||
debug other => _28; | ||
let mut _35: std::cmp::Ordering; | ||
scope 8 (inlined cmp::impls::<impl Ord for i16>::cmp) { | ||
debug self => _27; | ||
debug other => _28; | ||
let mut _29: i16; | ||
let mut _30: i16; | ||
let mut _31: bool; | ||
let mut _32: i16; | ||
let mut _33: i16; | ||
let mut _34: bool; | ||
} | ||
} | ||
|
||
bb0: { | ||
StorageLive(_3); | ||
_3 = &((*_1).0: u64); | ||
StorageLive(_4); | ||
_4 = &((*_2).0: u64); | ||
StorageLive(_11); | ||
StorageLive(_7); | ||
StorageLive(_5); | ||
_5 = ((*_1).0: u64); | ||
StorageLive(_6); | ||
_6 = ((*_2).0: u64); | ||
_7 = Lt(move _5, move _6); | ||
switchInt(move _7) -> [0: bb1, otherwise: bb5]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_6); | ||
StorageDead(_5); | ||
StorageLive(_10); | ||
StorageLive(_8); | ||
_8 = ((*_1).0: u64); | ||
StorageLive(_9); | ||
_9 = ((*_2).0: u64); | ||
_10 = Eq(move _8, move _9); | ||
switchInt(move _10) -> [0: bb2, otherwise: bb3]; | ||
} | ||
|
||
bb2: { | ||
StorageDead(_9); | ||
StorageDead(_8); | ||
_11 = const Greater; | ||
goto -> bb4; | ||
} | ||
|
||
bb3: { | ||
StorageDead(_9); | ||
StorageDead(_8); | ||
_11 = const Equal; | ||
goto -> bb4; | ||
} | ||
|
||
bb4: { | ||
StorageDead(_10); | ||
goto -> bb6; | ||
} | ||
|
||
bb5: { | ||
StorageDead(_6); | ||
StorageDead(_5); | ||
_11 = const Less; | ||
goto -> bb6; | ||
} | ||
|
||
bb6: { | ||
StorageDead(_7); | ||
_12 = Option::<std::cmp::Ordering>::Some(move _11); | ||
StorageDead(_11); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
_13 = discriminant(_12); | ||
switchInt(move _13) -> [1: bb7, otherwise: bb24]; | ||
} | ||
|
||
bb7: { | ||
_14 = discriminant(((_12 as Some).0: std::cmp::Ordering)); | ||
switchInt(move _14) -> [0: bb8, otherwise: bb24]; | ||
} | ||
|
||
bb8: { | ||
StorageLive(_15); | ||
_15 = &((*_1).1: char); | ||
StorageLive(_16); | ||
_16 = &((*_2).1: char); | ||
StorageLive(_23); | ||
StorageLive(_19); | ||
StorageLive(_17); | ||
_17 = ((*_1).1: char); | ||
StorageLive(_18); | ||
_18 = ((*_2).1: char); | ||
_19 = Lt(move _17, move _18); | ||
switchInt(move _19) -> [0: bb9, otherwise: bb13]; | ||
} | ||
|
||
bb9: { | ||
StorageDead(_18); | ||
StorageDead(_17); | ||
StorageLive(_22); | ||
StorageLive(_20); | ||
_20 = ((*_1).1: char); | ||
StorageLive(_21); | ||
_21 = ((*_2).1: char); | ||
_22 = Eq(move _20, move _21); | ||
switchInt(move _22) -> [0: bb10, otherwise: bb11]; | ||
} | ||
|
||
bb10: { | ||
StorageDead(_21); | ||
StorageDead(_20); | ||
_23 = const Greater; | ||
goto -> bb12; | ||
} | ||
|
||
bb11: { | ||
StorageDead(_21); | ||
StorageDead(_20); | ||
_23 = const Equal; | ||
goto -> bb12; | ||
} | ||
|
||
bb12: { | ||
StorageDead(_22); | ||
goto -> bb14; | ||
} | ||
|
||
bb13: { | ||
StorageDead(_18); | ||
StorageDead(_17); | ||
_23 = const Less; | ||
goto -> bb14; | ||
} | ||
|
||
bb14: { | ||
StorageDead(_19); | ||
_24 = Option::<std::cmp::Ordering>::Some(move _23); | ||
StorageDead(_23); | ||
StorageDead(_16); | ||
StorageDead(_15); | ||
_25 = discriminant(_24); | ||
switchInt(move _25) -> [1: bb15, otherwise: bb23]; | ||
} | ||
|
||
bb15: { | ||
_26 = discriminant(((_24 as Some).0: std::cmp::Ordering)); | ||
switchInt(move _26) -> [0: bb16, otherwise: bb23]; | ||
} | ||
|
||
bb16: { | ||
StorageLive(_27); | ||
_27 = &((*_1).2: i16); | ||
StorageLive(_28); | ||
_28 = &((*_2).2: i16); | ||
StorageLive(_35); | ||
StorageLive(_31); | ||
StorageLive(_29); | ||
_29 = ((*_1).2: i16); | ||
StorageLive(_30); | ||
_30 = ((*_2).2: i16); | ||
_31 = Lt(move _29, move _30); | ||
switchInt(move _31) -> [0: bb17, otherwise: bb21]; | ||
} | ||
|
||
bb17: { | ||
StorageDead(_30); | ||
StorageDead(_29); | ||
StorageLive(_34); | ||
StorageLive(_32); | ||
_32 = ((*_1).2: i16); | ||
StorageLive(_33); | ||
_33 = ((*_2).2: i16); | ||
_34 = Eq(move _32, move _33); | ||
switchInt(move _34) -> [0: bb18, otherwise: bb19]; | ||
} | ||
|
||
bb18: { | ||
StorageDead(_33); | ||
StorageDead(_32); | ||
_35 = const Greater; | ||
goto -> bb20; | ||
} | ||
|
||
bb19: { | ||
StorageDead(_33); | ||
StorageDead(_32); | ||
_35 = const Equal; | ||
goto -> bb20; | ||
} | ||
|
||
bb20: { | ||
StorageDead(_34); | ||
goto -> bb22; | ||
} | ||
|
||
bb21: { | ||
StorageDead(_30); | ||
StorageDead(_29); | ||
_35 = const Less; | ||
goto -> bb22; | ||
} | ||
|
||
bb22: { | ||
StorageDead(_31); | ||
_0 = Option::<std::cmp::Ordering>::Some(move _35); | ||
StorageDead(_35); | ||
StorageDead(_28); | ||
StorageDead(_27); | ||
goto -> bb25; | ||
} | ||
|
||
bb23: { | ||
_0 = _24; | ||
goto -> bb25; | ||
} | ||
|
||
bb24: { | ||
_0 = _12; | ||
goto -> bb25; | ||
} | ||
|
||
bb25: { | ||
return; | ||
} | ||
} |