-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Improve otherwise
handling in MaybeInitializedPlaces
/MaybeUninitializedPlaces
#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
Conversation
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. |
Let's see what perf says anyways @bors2 try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
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.
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (8494e68): comparison URL. Overall result: no relevant changes - no action neededBenchmarking 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 Instruction countThis 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.
CyclesResults (secondary 2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 464.174s -> 463.598s (-0.12%) |
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 |
04c8592
to
ee5374b
Compare
SwitchInt
target VariantIdx
s while building MaybePlacesSwitchIntData
otherwise
handling in MaybeInitializedPlaces
/MaybeUninitializedPlaces
Sorry for the inactivity! I went ahead and enabled the If the next perf run isn't generally positive, I'll just close this PR since the point was to try improving regressions from the last one (which was overall neutral anyway). @rustbot ready |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Improve `otherwise` handling in `MaybeInitializedPlaces`/`MaybeUninitializedPlaces`
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (7827a96): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking 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 Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.9%, secondary 0.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.1%, secondary -5.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 465.172s -> 465.292s (0.03%) |
No effect so I'll close. |
This PR adds a couple small changes to dataflow analysis intended to make the
otherwise
edge handling from #142707 more tidy and efficient:SwitchInt
and map their values toVariantIdx
while buildingMaybePlacesSwitchIntData
instead of inapply_effects_in_block
usingnext_discr
. Use thatVec
when handling theotherwise
target instead of making a newSmallVec
.otherwise
edge effects in MIR type check and borrow check.