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

Refactoring after the PlaceValue addition #124153

Merged
merged 1 commit into from
May 12, 2024

Conversation

scottmcm
Copy link
Member

@scottmcm scottmcm commented Apr 19, 2024

I added PlaceValue in #123775, but kept that one line-by-line simple because it touched so many places.

This goes through to add more helpers & docs, and change some PlaceRef to PlaceValue where the type didn't need to be included.

No behaviour changes -- the codegen is exactly the same.

@rustbot
Copy link
Collaborator

rustbot commented Apr 19, 2024

r? @compiler-errors

rustbot has assigned @compiler-errors.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Apr 19, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@scottmcm scottmcm force-pushed the more-placevalue branch 2 times, most recently from 7445e66 to a9ef67f Compare April 24, 2024 07:41
/// of the specified size and alignment.
///
/// The allocation itself is untyped.
pub fn alloca<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx, Value = V>>(
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm happy that #122053 landed since it means that it's reasonable to alloca a PlaceValue without a type.

@saethlin
Copy link
Member

r? saethlin

@rustbot rustbot assigned saethlin and unassigned compiler-errors May 10, 2024
@bors
Copy link
Contributor

bors commented May 10, 2024

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

@rust-log-analyzer

This comment has been minimized.

I added `PlaceValue` in 123775, but kept that one line-by-line simple because it touched so many places.

This goes through to add more helpers & docs, and change some `PlaceRef` to `PlaceValue` where the type didn't need to be included.

No behaviour changes.
@aapoalas
Copy link

I don't exactly understand the entire context and do not know the code base, but reading through I found no technical issues that would've struck out. Seems like a mostly nice mechanical cleanup: The pointer_parts helper function seemed a little magical (or too broad?) as taking it into use removed some inline comments in one place but after seeing what it actually does it's probably my favourite part of this PR. Nice and simple thing that had been repeated manually in way too many places.

Thinking on it now, I wonder if the helper should be marked #[inline]? Then again, LLVM is probably smarter than we are here.

Another thought I had was if some of the fields on PlaceValue and/or PlaceRef would benefit from being less public, so as to avoid eg. PlaceRef { val: llval .. } type of inline creation popping up again after this refactor.

Anyway, from someone not fully capable of saying this: Looks good to me.

@saethlin
Copy link
Member

Thinking on it now, I wonder if the helper should be marked #[inline]? Then again, LLVM is probably smarter than we are here.

For code in the compiler, that attribute has very little impact because the dist build use PGO+LTO+BOLT which tends to find all the obvious inlinings.

I agree that this is a nice improvement to a lot of this code. Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented May 11, 2024

📌 Commit 9be16eb has been approved by saethlin

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 May 11, 2024
@scottmcm
Copy link
Member Author

if some of the fields on PlaceValue and/or PlaceRef would benefit from being less public

I look forward to seeing restrictions get to the point where we'd be willing to use it in the compiler. Because I agree, but not enough to want to move everything to use accessor methods for things.

If the fields being read-only was a possibility -- so you could still match the types, etc -- then I agree that'd be great.

@bors
Copy link
Contributor

bors commented May 12, 2024

⌛ Testing commit 9be16eb with merge 8b64adc...

@bors
Copy link
Contributor

bors commented May 12, 2024

☀️ Test successful - checks-actions
Approved by: saethlin
Pushing 8b64adc to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 12, 2024
@bors bors merged commit 8b64adc into rust-lang:master May 12, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 12, 2024
@scottmcm scottmcm deleted the more-placevalue branch May 12, 2024 04:20
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8b64adc): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

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)
- - 0
Improvements ✅
(primary)
-3.3% [-3.3%, -3.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.3% [-3.3%, -3.3%] 1

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)
- - 0
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 673.458s -> 676.399s (0.44%)
Artifact size: 315.85 MiB -> 315.85 MiB (-0.00%)

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

8 participants