-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Add some pre-codegen MIR tests for debug mode #144875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,18 @@ | ||
//@ compile-flags: -Copt-level=0 -Zmir-opt-level=1 -Cdebuginfo=limited | ||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | ||
|
||
#![crate_type = "lib"] | ||
|
||
#[derive(PartialOrd, Ord, PartialEq, Eq)] | ||
pub struct MultiField(char, i16); | ||
|
||
// EMIT_MIR derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.mir | ||
// EMIT_MIR derived_ord_debug.{impl#1}-cmp.PreCodegen.after.mir | ||
|
||
// CHECK-LABEL: partial_cmp(_1: &MultiField, _2: &MultiField) -> Option<std::cmp::Ordering> | ||
// CHECK: = <char as PartialOrd>::partial_cmp( | ||
// CHECK: = <i16 as PartialOrd>::partial_cmp( | ||
|
||
// CHECK-LABEL: cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering | ||
// CHECK: = <char as Ord>::cmp( | ||
// CHECK: = <i16 as Ord>::cmp( |
52 changes: 52 additions & 0 deletions
52
...r-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir
This file contains hidden or 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,52 @@ | ||
// MIR for `<impl at $DIR/derived_ord_debug.rs:6:10: 6:20>::partial_cmp` after PreCodegen | ||
|
||
fn <impl at $DIR/derived_ord_debug.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 _3: &char; | ||
let _4: &char; | ||
let mut _5: std::option::Option<std::cmp::Ordering>; | ||
let mut _6: isize; | ||
let mut _7: i8; | ||
let _8: &i16; | ||
let _9: &i16; | ||
scope 1 { | ||
debug cmp => _5; | ||
} | ||
|
||
bb0: { | ||
_3 = &((*_1).0: char); | ||
_4 = &((*_2).0: char); | ||
_5 = <char as PartialOrd>::partial_cmp(copy _3, copy _4) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
_6 = discriminant(_5); | ||
switchInt(move _6) -> [1: bb2, 0: bb4, otherwise: bb6]; | ||
} | ||
|
||
bb2: { | ||
_7 = discriminant(((_5 as Some).0: std::cmp::Ordering)); | ||
switchInt(move _7) -> [0: bb3, otherwise: bb4]; | ||
} | ||
|
||
bb3: { | ||
_8 = &((*_1).1: i16); | ||
_9 = &((*_2).1: i16); | ||
_0 = <i16 as PartialOrd>::partial_cmp(copy _8, copy _9) -> [return: bb5, unwind unreachable]; | ||
} | ||
|
||
bb4: { | ||
_0 = copy _5; | ||
goto -> bb5; | ||
} | ||
|
||
bb5: { | ||
return; | ||
} | ||
|
||
bb6: { | ||
unreachable; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir
This file contains hidden or 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,52 @@ | ||
// MIR for `<impl at $DIR/derived_ord_debug.rs:6:10: 6:20>::partial_cmp` after PreCodegen | ||
|
||
fn <impl at $DIR/derived_ord_debug.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 _3: &char; | ||
let _4: &char; | ||
let mut _5: std::option::Option<std::cmp::Ordering>; | ||
let mut _6: isize; | ||
let mut _7: i8; | ||
let _8: &i16; | ||
let _9: &i16; | ||
scope 1 { | ||
debug cmp => _5; | ||
} | ||
|
||
bb0: { | ||
_3 = &((*_1).0: char); | ||
_4 = &((*_2).0: char); | ||
_5 = <char as PartialOrd>::partial_cmp(copy _3, copy _4) -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
_6 = discriminant(_5); | ||
switchInt(move _6) -> [1: bb2, 0: bb4, otherwise: bb6]; | ||
} | ||
|
||
bb2: { | ||
_7 = discriminant(((_5 as Some).0: std::cmp::Ordering)); | ||
switchInt(move _7) -> [0: bb3, otherwise: bb4]; | ||
} | ||
|
||
bb3: { | ||
_8 = &((*_1).1: i16); | ||
_9 = &((*_2).1: i16); | ||
_0 = <i16 as PartialOrd>::partial_cmp(copy _8, copy _9) -> [return: bb5, unwind continue]; | ||
} | ||
|
||
bb4: { | ||
_0 = copy _5; | ||
goto -> bb5; | ||
} | ||
|
||
bb5: { | ||
return; | ||
} | ||
|
||
bb6: { | ||
unreachable; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir
This file contains hidden or 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,42 @@ | ||
// MIR for `<impl at $DIR/derived_ord_debug.rs:6:22: 6:25>::cmp` after PreCodegen | ||
|
||
fn <impl at $DIR/derived_ord_debug.rs:6:22: 6:25>::cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering { | ||
debug self => _1; | ||
debug other => _2; | ||
let mut _0: std::cmp::Ordering; | ||
let _3: &char; | ||
let _4: &char; | ||
let mut _5: std::cmp::Ordering; | ||
let mut _6: i8; | ||
let _7: &i16; | ||
let _8: &i16; | ||
scope 1 { | ||
debug cmp => _5; | ||
} | ||
|
||
bb0: { | ||
_3 = &((*_1).0: char); | ||
_4 = &((*_2).0: char); | ||
_5 = <char as Ord>::cmp(copy _3, copy _4) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
_6 = discriminant(_5); | ||
switchInt(move _6) -> [0: bb2, otherwise: bb3]; | ||
} | ||
|
||
bb2: { | ||
_7 = &((*_1).1: i16); | ||
_8 = &((*_2).1: i16); | ||
_0 = <i16 as Ord>::cmp(copy _7, copy _8) -> [return: bb4, unwind unreachable]; | ||
} | ||
|
||
bb3: { | ||
_0 = copy _5; | ||
goto -> bb4; | ||
} | ||
|
||
bb4: { | ||
return; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir
This file contains hidden or 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,42 @@ | ||
// MIR for `<impl at $DIR/derived_ord_debug.rs:6:22: 6:25>::cmp` after PreCodegen | ||
|
||
fn <impl at $DIR/derived_ord_debug.rs:6:22: 6:25>::cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering { | ||
debug self => _1; | ||
debug other => _2; | ||
let mut _0: std::cmp::Ordering; | ||
let _3: &char; | ||
let _4: &char; | ||
let mut _5: std::cmp::Ordering; | ||
let mut _6: i8; | ||
let _7: &i16; | ||
let _8: &i16; | ||
scope 1 { | ||
debug cmp => _5; | ||
} | ||
|
||
bb0: { | ||
_3 = &((*_1).0: char); | ||
_4 = &((*_2).0: char); | ||
_5 = <char as Ord>::cmp(copy _3, copy _4) -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
_6 = discriminant(_5); | ||
switchInt(move _6) -> [0: bb2, otherwise: bb3]; | ||
} | ||
|
||
bb2: { | ||
_7 = &((*_1).1: i16); | ||
_8 = &((*_2).1: i16); | ||
_0 = <i16 as Ord>::cmp(copy _7, copy _8) -> [return: bb4, unwind continue]; | ||
} | ||
|
||
bb3: { | ||
_0 = copy _5; | ||
goto -> bb4; | ||
} | ||
|
||
bb4: { | ||
return; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
tests/mir-opt/pre-codegen/option_bubble_debug.option_direct.PreCodegen.after.panic-abort.mir
This file contains hidden or 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,37 @@ | ||
// MIR for `option_direct` after PreCodegen | ||
|
||
fn option_direct(_1: Option<u32>) -> Option<u32> { | ||
debug x => _1; | ||
let mut _0: std::option::Option<u32>; | ||
let mut _2: isize; | ||
let _3: u32; | ||
let mut _4: u32; | ||
scope 1 { | ||
debug x => _3; | ||
} | ||
|
||
bb0: { | ||
_2 = discriminant(_1); | ||
switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; | ||
} | ||
|
||
bb1: { | ||
_0 = Option::<u32>::None; | ||
goto -> bb3; | ||
} | ||
|
||
bb2: { | ||
_3 = copy ((_1 as Some).0: u32); | ||
_4 = Not(copy _3); | ||
_0 = Option::<u32>::Some(move _4); | ||
goto -> bb3; | ||
} | ||
|
||
bb3: { | ||
return; | ||
} | ||
|
||
bb4: { | ||
unreachable; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...s/mir-opt/pre-codegen/option_bubble_debug.option_direct.PreCodegen.after.panic-unwind.mir
This file contains hidden or 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,37 @@ | ||
// MIR for `option_direct` after PreCodegen | ||
|
||
fn option_direct(_1: Option<u32>) -> Option<u32> { | ||
debug x => _1; | ||
let mut _0: std::option::Option<u32>; | ||
let mut _2: isize; | ||
let _3: u32; | ||
let mut _4: u32; | ||
scope 1 { | ||
debug x => _3; | ||
} | ||
|
||
bb0: { | ||
_2 = discriminant(_1); | ||
switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; | ||
} | ||
|
||
bb1: { | ||
_0 = Option::<u32>::None; | ||
goto -> bb3; | ||
} | ||
|
||
bb2: { | ||
_3 = copy ((_1 as Some).0: u32); | ||
_4 = Not(copy _3); | ||
_0 = Option::<u32>::Some(move _4); | ||
goto -> bb3; | ||
} | ||
|
||
bb3: { | ||
return; | ||
} | ||
|
||
bb4: { | ||
unreachable; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
tests/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-abort.mir
This file contains hidden or 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,47 @@ | ||
// MIR for `option_traits` after PreCodegen | ||
|
||
fn option_traits(_1: Option<u32>) -> Option<u32> { | ||
debug x => _1; | ||
let mut _0: std::option::Option<u32>; | ||
let mut _2: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; | ||
let mut _3: isize; | ||
let _4: u32; | ||
let mut _5: u32; | ||
scope 1 { | ||
debug residual => const Option::<Infallible>::None; | ||
scope 2 { | ||
} | ||
} | ||
scope 3 { | ||
debug val => _4; | ||
scope 4 { | ||
} | ||
} | ||
|
||
bb0: { | ||
_2 = <Option<u32> as Try>::branch(copy _1) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
_3 = discriminant(_2); | ||
switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb5]; | ||
} | ||
|
||
bb2: { | ||
_4 = copy ((_2 as Continue).0: u32); | ||
_5 = Not(copy _4); | ||
_0 = <Option<u32> as Try>::from_output(move _5) -> [return: bb4, unwind unreachable]; | ||
} | ||
|
||
bb3: { | ||
_0 = <Option<u32> as FromResidual<Option<Infallible>>>::from_residual(const Option::<Infallible>::None) -> [return: bb4, unwind unreachable]; | ||
} | ||
|
||
bb4: { | ||
return; | ||
} | ||
|
||
bb5: { | ||
unreachable; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...s/mir-opt/pre-codegen/option_bubble_debug.option_traits.PreCodegen.after.panic-unwind.mir
This file contains hidden or 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,47 @@ | ||
// MIR for `option_traits` after PreCodegen | ||
|
||
fn option_traits(_1: Option<u32>) -> Option<u32> { | ||
debug x => _1; | ||
let mut _0: std::option::Option<u32>; | ||
let mut _2: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; | ||
let mut _3: isize; | ||
let _4: u32; | ||
let mut _5: u32; | ||
scope 1 { | ||
debug residual => const Option::<Infallible>::None; | ||
scope 2 { | ||
} | ||
} | ||
scope 3 { | ||
debug val => _4; | ||
scope 4 { | ||
} | ||
} | ||
|
||
bb0: { | ||
_2 = <Option<u32> as Try>::branch(copy _1) -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
_3 = discriminant(_2); | ||
switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb5]; | ||
} | ||
|
||
bb2: { | ||
_4 = copy ((_2 as Continue).0: u32); | ||
_5 = Not(copy _4); | ||
_0 = <Option<u32> as Try>::from_output(move _5) -> [return: bb4, unwind continue]; | ||
} | ||
|
||
bb3: { | ||
_0 = <Option<u32> as FromResidual<Option<Infallible>>>::from_residual(const Option::<Infallible>::None) -> [return: bb4, unwind continue]; | ||
} | ||
|
||
bb4: { | ||
return; | ||
} | ||
|
||
bb5: { | ||
unreachable; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is particularly unfortunate because it's really just
_0 = None
, so the call is about as wasteful as is possible.