Consider inexpensive inlining criteria first#82491
Merged
bors merged 1 commit intorust-lang:masterfrom Feb 26, 2021
Merged
Conversation
Refactor inlining decisions so that inexpensive criteria are considered first: 1. Based on code generation attributes. 2. Based on MIR availability (examines call graph). 3. Based on MIR body.
Contributor
|
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
lcnr
reviewed
Feb 26, 2021
| // a lower `HirId` than the callee. This ensures that the callee will | ||
| // not inline us. This trick only works without incremental compilation. | ||
| // So don't do it if that is enabled. | ||
| if !self.tcx.dep_graph.is_fully_enabled() && self.hir_id < callee_hir_id { |
Contributor
There was a problem hiding this comment.
is that check even necessary?
I would expect us to now prevent this thanks to mir_callgraph_reachable
apart from that r=me
Contributor
Author
There was a problem hiding this comment.
It is valuable as an optimization to avoid using mir_callgraph_reachable which is way more expensive in comparison.
Contributor
There was a problem hiding this comment.
ah wait, we use this to always return Ok(()), even if we have a cycle in the call graph.
That's clever ✨
Contributor
|
@bors r+ rollup |
Collaborator
|
📌 Commit 6d5c0c1 has been approved by |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Feb 26, 2021
Consider inexpensive inlining criteria first Refactor inlining decisions so that inexpensive criteria are considered first: 1. Based on code generation attributes. 2. Based on MIR availability (examines call graph). 3. Based on MIR body.
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Feb 26, 2021
Consider inexpensive inlining criteria first Refactor inlining decisions so that inexpensive criteria are considered first: 1. Based on code generation attributes. 2. Based on MIR availability (examines call graph). 3. Based on MIR body.
This was referenced Feb 26, 2021
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 26, 2021
…laumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#81940 (Stabilize str_split_once) - rust-lang#82165 (Reword labels on E0308 involving async fn return type) - rust-lang#82456 (Replaced some unwrap_or and map_or with lazy variants) - rust-lang#82491 (Consider inexpensive inlining criteria first) - rust-lang#82506 (Properly account for non-shorthand pattern field in unused variable lint) - rust-lang#82535 (Set codegen thread names) - rust-lang#82545 (rustdoc: add optional woff2 versions of FiraSans.) - rust-lang#82549 (Revert "Update normalize.css to 8.0.1") Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactor inlining decisions so that inexpensive criteria are considered first: