-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Avoid MIR bloat in inlining #127113
Merged
Merged
Avoid MIR bloat in inlining #127113
Changes from all commits
Commits
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 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
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
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
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
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
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
22 changes: 22 additions & 0 deletions
22
...ir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-abort.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,22 @@ | ||
// MIR for `marked_inline_direct` after Inline | ||
|
||
fn marked_inline_direct(_1: i32) -> () { | ||
debug x => _1; | ||
let mut _0: (); | ||
let _2: (); | ||
let mut _3: i32; | ||
|
||
bb0: { | ||
StorageLive(_2); | ||
StorageLive(_3); | ||
_3 = _1; | ||
_2 = call_twice(move _3) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_3); | ||
StorageDead(_2); | ||
_0 = const (); | ||
return; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...r-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-unwind.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,22 @@ | ||
// MIR for `marked_inline_direct` after Inline | ||
|
||
fn marked_inline_direct(_1: i32) -> () { | ||
debug x => _1; | ||
let mut _0: (); | ||
let _2: (); | ||
let mut _3: i32; | ||
|
||
bb0: { | ||
StorageLive(_2); | ||
StorageLive(_3); | ||
_3 = _1; | ||
_2 = call_twice(move _3) -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_3); | ||
StorageDead(_2); | ||
_0 = const (); | ||
return; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-abort.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,27 @@ | ||
// MIR for `marked_inline_indirect` after Inline | ||
|
||
fn marked_inline_indirect(_1: i32) -> () { | ||
debug x => _1; | ||
let mut _0: (); | ||
let _2: (); | ||
let mut _3: i32; | ||
scope 1 (inlined marked_inline_direct) { | ||
let _4: (); | ||
} | ||
|
||
bb0: { | ||
StorageLive(_2); | ||
StorageLive(_3); | ||
_3 = _1; | ||
StorageLive(_4); | ||
_4 = call_twice(move _3) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
StorageDead(_2); | ||
_0 = const (); | ||
return; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-unwind.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,27 @@ | ||
// MIR for `marked_inline_indirect` after Inline | ||
|
||
fn marked_inline_indirect(_1: i32) -> () { | ||
debug x => _1; | ||
let mut _0: (); | ||
let _2: (); | ||
let mut _3: i32; | ||
scope 1 (inlined marked_inline_direct) { | ||
let _4: (); | ||
} | ||
|
||
bb0: { | ||
StorageLive(_2); | ||
StorageLive(_3); | ||
_3 = _1; | ||
StorageLive(_4); | ||
_4 = call_twice(move _3) -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
StorageDead(_2); | ||
_0 = const (); | ||
return; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-abort.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,34 @@ | ||
// MIR for `monomorphic_not_inline` after Inline | ||
|
||
fn monomorphic_not_inline(_1: i32) -> () { | ||
debug x => _1; | ||
let mut _0: (); | ||
let _2: (); | ||
let mut _3: i32; | ||
scope 1 (inlined call_twice) { | ||
let _4: (); | ||
let _5: (); | ||
} | ||
|
||
bb0: { | ||
StorageLive(_2); | ||
StorageLive(_3); | ||
_3 = _1; | ||
StorageLive(_4); | ||
StorageLive(_5); | ||
_4 = other_thing(_3) -> [return: bb2, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_5); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
StorageDead(_2); | ||
_0 = const (); | ||
return; | ||
} | ||
|
||
bb2: { | ||
_5 = other_thing(move _3) -> [return: bb1, unwind unreachable]; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-unwind.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,34 @@ | ||
// MIR for `monomorphic_not_inline` after Inline | ||
|
||
fn monomorphic_not_inline(_1: i32) -> () { | ||
debug x => _1; | ||
let mut _0: (); | ||
let _2: (); | ||
let mut _3: i32; | ||
scope 1 (inlined call_twice) { | ||
let _4: (); | ||
let _5: (); | ||
} | ||
|
||
bb0: { | ||
StorageLive(_2); | ||
StorageLive(_3); | ||
_3 = _1; | ||
StorageLive(_4); | ||
StorageLive(_5); | ||
_4 = other_thing(_3) -> [return: bb2, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_5); | ||
StorageDead(_4); | ||
StorageDead(_3); | ||
StorageDead(_2); | ||
_0 = const (); | ||
return; | ||
} | ||
|
||
bb2: { | ||
_5 = other_thing(move _3) -> [return: bb1, unwind continue]; | ||
} | ||
} |
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.
may be useful to look into methods that only forward to other methods, but may trigger autoderef through
Deref
impls or other things that can cause this method to returnfalse
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.
Yeah, a bigger version of the problem here is that we just loop through the blocks in order, inlining stuff.
If I find time I want to try some bigger changes like a p-queue of
Call
s so I could do things like apply the trivial things first, then apply a check like this to decide whether to continue.