Skip to content

Collect SwitchInt target VariantIdxs while building MaybePlacesSwitchIntData #143852

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ashivaram23
Copy link
Contributor

@ashivaram23 ashivaram23 commented Jul 12, 2025

This could make MaybeInitializedPlaces/MaybeUninitializedPlaces analysis slightly more efficient, particularly after #142707.

@rustbot
Copy link
Collaborator

rustbot commented Jul 12, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
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 Jul 12, 2025
@ashivaram23
Copy link
Contributor Author

Note: I don't imagine this will have a major perf impact unless there's an enum with a hundred variants. I also don't expect this to fix the regressions from #142707 which I believe are largely from how the generated code interacts with later passes and LLVM.

@compiler-errors
Copy link
Member

Let's see what perf says anyways

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jul 12, 2025

⌛ Trying commit 04c8592 with merge 8494e68

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jul 12, 2025
Collect `SwitchInt` target `VariantIdx`s while building `MaybePlacesSwitchIntData`

- Filter discriminants involved in a `SwitchInt` and map their values to `VariantIdx` while building `MaybePlacesSwitchIntData` instead of in `apply_effects_in_block` using `next_discr`. This is easier after #143769.
- Use that `Vec` when handling the `otherwise` target instead of making a new `SmallVec`.

This could make `MaybeInitializedPlaces`/`MaybeUninitializedPlaces` analysis slightly more efficient, particularly after #142707.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 12, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 12, 2025

☀️ Try build successful (CI)
Build commit: 8494e68 (8494e6881d8ac4d5f15e3ed5b25fc7c1cac5a7f8, parent: bfc046a4b8d6b57db02540182466e989a9b0fb40)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8494e68): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary -1.6%, secondary 2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.5% [2.0%, 6.9%] 2
Improvements ✅
(primary)
-1.6% [-1.6%, -1.6%] 2
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) -1.6% [-1.6%, -1.6%] 2

Cycles

Results (secondary 2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 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: 464.174s -> 463.598s (-0.12%)
Artifact size: 374.70 MiB -> 374.72 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 13, 2025
@ashivaram23
Copy link
Contributor Author

Without any reported improvements at all I don't think this has much of a point 🙃 Another followup to #142707 I wanted to try was enabling otherwise handling for more than just drop elaboration, which will probably have a noticeable effect one way or the other. I guess I could just tack that onto this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants