Skip to content

New mir-opt deref_separator - #95649

Merged
bors merged 5 commits into
rust-lang:masterfrom
ouz-a:mir-opt
Apr 6, 2022
Merged

New mir-opt deref_separator#95649
bors merged 5 commits into
rust-lang:masterfrom
ouz-a:mir-opt

Conversation

@ouz-a

@ouz-aouz-a commented Apr 4, 2022

Copy link
Copy Markdown
Contributor

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.

@rustbotrustbot 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
Copy Markdown
Contributor

r? @estebank

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

@rust-highfiverust-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
Copy Markdown
Contributor

r? @oli-obk

@rust-highfiverust-highfive assigned oli-obk and unassigned estebankApr 4, 2022
@rust-log-analyzer

This comment has been minimized.

Comment threadcompiler/rustc_mir_transform/src/deref_separator.rs Outdated
// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
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.

Comment threadcompiler/rustc_mir_transform/src/deref_separator.rs Outdated
Comment threadcompiler/rustc_mir_transform/src/deref_separator.rs Outdated
@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Apr 6, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 1cf6d69 has been approved by oli-obk

@borsbors 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.
@Dylan-DPCDylan-DPC mentioned this pull request Apr 6, 2022
@Dylan-DPCDylan-DPC mentioned this pull request Apr 6, 2022
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:masterApr 6, 2022
@rustbotrustbot 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 ❤️
@ouz-aouz-a mentioned this pull request Apr 16, 2022
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_`
@ouz-aouz-a mentioned this pull request Apr 29, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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

@ouz-a@rust-highfive@oli-obk@rust-log-analyzer@bors@estebank@rustbot