Centralize live loans maintenance to fix scope differences due to liveness#118175
Merged
bors merged 5 commits intorust-lang:masterfrom Dec 2, 2023
Merged
Centralize live loans maintenance to fix scope differences due to liveness#118175bors merged 5 commits intorust-lang:masterfrom
bors merged 5 commits intorust-lang:masterfrom
Conversation
This was referenced Nov 22, 2023
This comment was marked as resolved.
This comment was marked as resolved.
b5b0002 to
3328432
Compare
This comment was marked as resolved.
This comment was marked as resolved.
3328432 to
1666165
Compare
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 1, 2023
…=matthewjasper Refactor NLL constraint generation and most of polonius fact generation As discussed in rust-lang#118175, NLL "constraint generation" is only about liveness, but currently also contains legacy polonius fact generation. The latter is quite messy, and this PR cleans this up to prepare for its future removal: - splits polonius fact generation out of NLL constraint generation - merges NLL constraint generation to its more natural place, liveness - extracts all of the polonius fact generation from NLLs apart from MIR typeck (as fact generation is somewhat in a single place there already, but should be cleaned up) into its own explicit module, with a single entry point instead of many. There should be no behavior changes, and tests seem to behave the same as master: without polonius, with legacy polonius, with the in-tree polonius. I've split everything into smaller logical commits for easier review, as it required quite a bit of code to be split and moved around, but it should all be trivial changes. r? `@matthewjasper`
for consistency with how they're named everywhere else
Liveness data is pushed from multiple parts of NLL. Instead of changing the call sites to maintain live loans, move the latter to `LivenessValues` where this liveness data is pushed to, and maintain live loans there. This fixes the differences in polonius scopes on some CFGs where a variable was dead in tracing but as a MIR terminator its regions were marked live from "constraint generation"
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
|
@bors r+ |
Collaborator
Collaborator
Collaborator
|
☀️ Test successful - checks-actions |
Collaborator
|
Finished benchmarking commit (bd3a221): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 672.846s -> 672.083s (-0.11%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As found in the recent polonius crater run, NLLs and the location-insensitive polonius computed different scopes on some specific CFG shapes, e.g. the following.
I had missed that liveness data was pushed from different sources than just the liveness computation: there are a few places that do this -- and some of them may be unneeded or at the very least untested, as no tests changed when I tried removing some of them.
Here,
_6is e.g. dead on entry tobb2[0]duringliveness::trace, but its regions will be marked as live later during "constraint generation" (which I plan to refactor away and put in the liveness module soon). This should cause the inflowing loans to be marked live, but they were only computed inliveness::trace.Therefore, this PR moves live loan maintenance to
LivenessValues, so that the various places pushing liveness data will all also update live loans at the same time -- except for promoteds which I don't believe need them, and their liveness handling is already interesting/peculiar.All the regressions I saw in the initial crater run were related to this kind of shapes, and this change did fix all of them on the next run.
r? @matthewjasper
(This will conflict with #117880 but whichever lands first is fine by me, the end goal is the same for both)