Skip to content

Use PlaceRef abstractions more often #112693

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

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

ericmarkmartin
Copy link
Contributor

@ericmarkmartin ericmarkmartin commented Jun 16, 2023

Associated issue: #80647

r? @spastorino

@rustbot
Copy link
Collaborator

rustbot commented Jun 16, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @b-naber (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 16, 2023
@ericmarkmartin
Copy link
Contributor Author

@rustbot label +S-waiting-on-author -S-waiting-on-review

@rustbot rustbot 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 16, 2023
@rustbot rustbot assigned spastorino and unassigned b-naber Jun 16, 2023
@rust-log-analyzer

This comment has been minimized.

@spastorino
Copy link
Member

@ericmarkmartin this is looking good IMO.

@ericmarkmartin ericmarkmartin marked this pull request as ready for review June 19, 2023 23:14
@rustbot
Copy link
Collaborator

rustbot commented Jun 19, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@ericmarkmartin
Copy link
Contributor Author

@rustbot label -S-waiting-on-author +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 19, 2023
},
projection: tcx.mk_place_elems(place_ref.projection),
}
.project_deeper(&[elem], tcx),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a project_deeper method on PlaceRef, to avoid interning twice?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or should BorrowedContent take a PlaceRef?

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 think PlaceRef already had that. I'm not sure I'm really qualified to have a take on what BorrowedContent should take but even if it took a PlaceRef we'd need some way to produce the extended PlaceRef. We could also try building the iterator so that we have access to the subsequent projection in each iteration, but I'm not sure how worth it that is.

local: place.local,
projection: tcx.mk_place_elems(place_ref.projection),
}
.project_deeper(&[elem], tcx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Likewise.

let parent = Place {
local: place_ref.local,
projection: self.tcx.mk_place_elems(place_ref.projection),
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we use place_ref directly here?

let parent = Place {
local: place_ref.local,
projection: self.tcx.mk_place_elems(place_ref.projection),
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use place_ref directly in this code?

@cjgillot
Copy link
Contributor

Thanks! r=me with commits squashed.

@spastorino
Copy link
Member

This looks great now, please squash the commits into one or into a few of meaningful commits and then we can merge. Thanks for your work.

@ericmarkmartin
Copy link
Contributor Author

r? @cjgillot

@rustbot rustbot assigned cjgillot and unassigned spastorino Jun 26, 2023
@spastorino
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 26, 2023

📌 Commit c07c10d has been approved by spastorino

It is now in the queue for this repository.

@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 Jun 26, 2023
@ericmarkmartin
Copy link
Contributor Author

Thanks @spastorino and @cjgillot (and the rustc-dev-guide) for making the experience of writing my first PR to rust so pleasant!

@bors
Copy link
Collaborator

bors commented Jun 27, 2023

⌛ Testing commit c07c10d with merge b9ad9b7...

@bors
Copy link
Collaborator

bors commented Jun 27, 2023

☀️ Test successful - checks-actions
Approved by: spastorino
Pushing b9ad9b7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 27, 2023
@bors bors merged commit b9ad9b7 into rust-lang:master Jun 27, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 27, 2023
@ericmarkmartin ericmarkmartin deleted the use-more-placeref branch June 27, 2023 04:05
@bors bors mentioned this pull request Jun 27, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b9ad9b7): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

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
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.0% [0.7%, 1.4%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [-0.6%, 1.4%] 6

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-2.8%, -2.1%] 2
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.5% [2.8%, 4.2%] 3
Regressions ❌
(secondary)
3.0% [2.1%, 4.1%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.5% [2.8%, 4.2%] 3

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 662.213s -> 661.833s (-0.06%)

@rustbot rustbot added the perf-regression Performance regression. label Jun 27, 2023
@lqd
Copy link
Member

lqd commented Jun 27, 2023

cargo and bitmaps noise, stabilized in the next merge.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 27, 2023
@spastorino
Copy link
Member

@ericmarkmartin thanks to you for the contribution. Let's keep in touch on Zulip in case you want to contribute more :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

9 participants