Skip to content

Pull Derefer before ElaborateDrops - #98145

Merged
bors merged 2 commits into
rust-lang:masterfrom
ouz-a:some_branch
Jul 13, 2022
Merged

Pull Derefer before ElaborateDrops#98145
bors merged 2 commits into
rust-lang:masterfrom
ouz-a:some_branch

Conversation

@ouz-a

Copy link
Copy Markdown
Contributor

Follow up work to #97025#96549#96116#95887#95649

This moves Derefer before ElaborateDrops and creates a new Rvalue called VirtualRef that allows us to bypass many constraints for DerefTemp.

r? @oli-obk

@rustbotrustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 15, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 15, 2022
@bors

bors commented Jun 20, 2022

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #97931) made this pull request unmergeable. Please resolve the merge conflicts.

Comment threadcompiler/rustc_borrowck/src/lib.rs Outdated
Comment threadcompiler/rustc_const_eval/src/interpret/step.rs Outdated
Comment threadcompiler/rustc_const_eval/src/transform/check_consts/qualifs.rs Outdated
Comment threadcompiler/rustc_middle/src/mir/mod.rs Outdated
Comment threadcompiler/rustc_middle/src/mir/tcx.rs Outdated
Comment threadcompiler/rustc_middle/src/mir/type_foldable.rs Outdated
Comment threadcompiler/rustc_mir_dataflow/src/move_paths/builder.rs Outdated
Comment threadcompiler/rustc_mir_transform/src/elaborate_drops.rs Outdated
Comment threadcompiler/rustc_mir_transform/src/elaborate_drops.rs Outdated
Comment threadcompiler/rustc_middle/src/mir/mod.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@oli-obk

Copy link
Copy Markdown
Contributor

@rustbot author

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 21, 2022
@ouz-a
ouz-aforce-pushed the some_branch branch 3 times, most recently from 9565104 to 2659f22CompareJune 21, 2022 12:45
Comment threadcompiler/rustc_middle/src/mir/mod.rs Outdated
@bors

bors commented Jun 21, 2022

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #95576) made this pull request unmergeable. Please resolve the merge conflicts.

@bors

bors commented Jun 22, 2022

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #98359) made this pull request unmergeable. Please resolve the merge conflicts.

@ouz-a
ouz-aforce-pushed the some_branch branch 4 times, most recently from 3243226 to aa91716CompareJune 22, 2022 19:37
@ouz-a
ouz-a requested a review from oli-obkJune 22, 2022 19:37
@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jun 23, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit aa91716 has been approved by oli-obk

@bors

bors commented Jun 23, 2022

Copy link
Copy Markdown
Collaborator

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@borsbors removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 23, 2022
@bors

bors commented Jul 12, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit b4c3a2a has been approved by oli-obk

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 12, 2022
@bors

bors commented Jul 13, 2022

Copy link
Copy Markdown
Collaborator

⌛ Testing commit b4c3a2a with merge 42bd138...

@bors

bors commented Jul 13, 2022

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 42bd138 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jul 13, 2022
@bors
bors merged commit 42bd138 into rust-lang:masterJul 13, 2022
@rustbotrustbot added this to the 1.64.0 milestone Jul 13, 2022
@borsbors mentioned this pull request Jul 13, 2022
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (42bd138): comparison url.

Instruction count

  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: 😿 relevant regressions found
mean1maxcount2
Regressions 😿
(primary)
0.5%0.8%13
Regressions 😿
(secondary)
0.7%1.1%20
Improvements 🎉
(primary)
N/AN/A0
Improvements 🎉
(secondary)
N/AN/A0
All 😿🎉 (primary)0.5%0.8%13

Max RSS (memory usage)

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
mean1maxcount2
Regressions 😿
(primary)
N/AN/A0
Regressions 😿
(secondary)
3.0%3.1%2
Improvements 🎉
(primary)
N/AN/A0
Improvements 🎉
(secondary)
-9.1%-9.1%1
All 😿🎉 (primary)N/AN/A0

Cycles

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: 🎉 relevant improvement found
mean1maxcount2
Regressions 😿
(primary)
N/AN/A0
Regressions 😿
(secondary)
N/AN/A0
Improvements 🎉
(primary)
-3.1%-3.1%1
Improvements 🎉
(secondary)
-2.9%-2.9%1
All 😿🎉 (primary)-3.1%-3.1%1

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression

Footnotes

  1. the arithmetic mean of the percent change23

  2. number of relevant changes23

@rustbotrustbot added the perf-regression Performance regression. label Jul 13, 2022
@oli-obk

Copy link
Copy Markdown
Contributor

hmm... looks like all mir queries got a few percent slower. I guess open an issue to track this regression to see if it goes away once we get rid of the new Rvalue

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 18, 2022
Pull Derefer before ElaborateDrops
_Follow up work to rust-lang#97025rust-lang#96549rust-lang#96116rust-lang#95887 #95649_
This moves `Derefer` before `ElaborateDrops` and creates a new `Rvalue` called `VirtualRef` that allows us to bypass many constraints for `DerefTemp`.
r? `@oli-obk`
@rylev

Copy link
Copy Markdown
Member

@oli-obk@ouz-a can you open an issue to track the regression here? I'm nervous that this will just get lost.

@Dylan-DPC

Copy link
Copy Markdown
Member

@oli-obk@ouz-a can you open an issue to track the regression here? I'm nervous that this will just get lost.

@rylev i opened #99473 for this

@ouz-a

Copy link
Copy Markdown
ContributorAuthor

@oli-obk@ouz-a can you open an issue to track the regression here? I'm nervous that this will just get lost.

I was planning to open a PR without the new Rvalue

@ouz-aouz-a mentioned this pull request Jul 20, 2022
@ouz-aouz-a mentioned this pull request Jul 24, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 29, 2022
Optimize `UnDerefer`
Addresses the performance [issues](rust-lang#98145 (comment)) faced here.
r? `@oli-obk`
@beepster4096beepster4096 mentioned this pull request Jun 21, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 30, 2023
Rewrite `UnDerefer`
Currently, `UnDerefer` is used by drop elaboration to undo the effects of the `Derefer` pass. However, it just recreates the original places with derefs in the middle of the projection. Because `ProjectionElem::Deref` is intended to be removed completely in the future, this will not work forever.
This PR introduces a `deref_chain` method that returns the places behind `DerefTemp` locals in a place and rewrites the move path code to use this. In the process, `UnDerefer` was merged into `MovePathLookup`. Now that move paths use the same places as in the MIR, the other uses of `UnDerefer` no longer require it.
See rust-lang#98145
cc `@ouz-a`
r? `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 3, 2023
Rewrite `UnDerefer`
Currently, `UnDerefer` is used by drop elaboration to undo the effects of the `Derefer` pass. However, it just recreates the original places with derefs in the middle of the projection. Because `ProjectionElem::Deref` is intended to be removed completely in the future, this will not work forever.
This PR introduces a `deref_chain` method that returns the places behind `DerefTemp` locals in a place and rewrites the move path code to use this. In the process, `UnDerefer` was merged into `MovePathLookup`. Now that move paths use the same places as in the MIR, the other uses of `UnDerefer` no longer require it.
See rust-lang#98145
cc `@ouz-a`
r? `@oli-obk`
Kobzol pushed a commit to Kobzol/portable-simd that referenced this pull request Feb 3, 2026
Optimize `UnDerefer`
Addresses the performance [issues](rust-lang/rust#98145 (comment)) faced here.
r? `@oli-obk`
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.perf-regressionPerformance regression.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.

11 participants

@ouz-a@rust-highfive@bors@rust-log-analyzer@oli-obk@RalfJung@rustbot@JakobDegen@Dylan-DPC@rust-timer@rylev