Skip to content
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

New mir-opt deref_separator #95649

Merged
merged 5 commits into from
Apr 6, 2022
Merged

New mir-opt deref_separator #95649

merged 5 commits into from
Apr 6, 2022

Conversation

ouz-a
Copy link
Contributor

@ouz-a ouz-a commented Apr 4, 2022

This adds a new mir-opt that split certain derefs into this form:
let x = (*a.b).c; to => tmp = a.b; let x = (*tmp).c;

Huge thanks to @oli-obk for his patient mentoring.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 4, 2022
@rust-highfive
Copy link
Collaborator

r? @estebank

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 4, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Apr 4, 2022

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned estebank Apr 4, 2022
@rust-log-analyzer

This comment has been minimized.

// and copying derefed values which we need to create new statement
let temp_place =
Place::from(temp).project_deeper(&place.projection[idx..], tcx);
patch.add_assign(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This add call is now not necessary anymore, as the exact same statement is created via mutation below

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you can add though is a storagdead statement for the temp. Maybe that'll eliminate the extra cleanup block that showed up in a bunch of tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mir dump looks clean now 😸

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still a bunch of new cleanup blocks showing up. Let's see if a storagedead resolves those.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought storagedead would resolve all of those 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, misread the code. Yea, not sure what is going on, i'll investigate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's just MirPatch doing that eagerly even if unneeded.

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 6, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Apr 6, 2022

📌 Commit 1cf6d69 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 6, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 6, 2022
New mir-opt deref_separator

This adds a new mir-opt that split certain derefs into this form:
`let x = (*a.b).c;` to => `tmp = a.b; let x = (*tmp).c;`

Huge thanks to `@oli-obk` for his patient mentoring.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 6, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#95342 (Ignore "format the world" commit in git blame)
 - rust-lang#95353 ([bootstrap] Give a hard error when filtering tests for a file that does not exist)
 - rust-lang#95649 (New mir-opt deref_separator)
 - rust-lang#95721 (Fix typo in bootstrap/setup.rs)
 - rust-lang#95730 (Rename RWLock to RwLock in std::sys.)
 - rust-lang#95731 (Check that all hidden types are the same and then deduplicate them.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9fa941c into rust-lang:master Apr 6, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 6, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 9, 2022
Allow multiple derefs to be splitted in deref_separator

Previously in rust-lang#95649 only a single deref within projection was supported and multiple derefs caused a bunch of issues, this PR fixes those issues.

`@oli-obk` helped a ton again ❤️
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 10, 2022
Allow multiple derefs to be splitted in deref_separator

Previously in rust-lang#95649 only a single deref within projection was supported and multiple derefs caused a bunch of issues, this PR fixes those issues.

``@oli-obk`` helped a ton again ❤️
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 10, 2022
Allow multiple derefs to be splitted in deref_separator

Previously in rust-lang#95649 only a single deref within projection was supported and multiple derefs caused a bunch of issues, this PR fixes those issues.

```@oli-obk``` helped a ton again ❤️
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2022
Make derefer work everwhere

Follow up work on previous PR's rust-lang#95649 and rust-lang#95857.

r? rust-lang/mir-opt

_Co-Authored-By: `@oli-obk_`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants