Mark more locals as moved to avoid building drops for them.#158281
Mark more locals as moved to avoid building drops for them.#158281cjgillot wants to merge 4 commits into
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Does this have user-visible behavior changes? e.g., see #156713 |
|
Yes. With this change, both cases in #156713 pass. We also have a few user-visible consequences with the drop order lint. |
|
@rustbot reroll |
51861b3 to
d128dba
Compare
This comment has been minimized.
This comment has been minimized.
a5dd21c to
4ff8c26
Compare
This comment has been minimized.
This comment has been minimized.
4ff8c26 to
90e4893
Compare
This comment has been minimized.
This comment has been minimized.
90e4893 to
a851b9e
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Mark more locals as moved to avoid building drops for them.
|
Since this PR has insta-stable changes, I think this will need to go through an FCP. Could you describe what the user-facing changes are, and lang-nominate the PR? |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (9ef0dc4): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @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 -1.2%, secondary 0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 4.5%, secondary 75.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 488.761s -> 487.76s (-0.20%) |
And some more cases along the way. We have a specific optimization to avoid generating useless drops, use it. In particular, aggregate construction are very similar to function calls for which this is designed.
a851b9e to
650bed1
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Mark more locals as moved to avoid building drops for them.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (68a2829): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @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 1.7%, secondary 2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 6.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 489.809s -> 489.874s (0.01%) |
|
☔ The latest upstream changes (presumably #159213) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
MIR building skips generating drops for moved-from locals in the topmost scope. This was only used for call terminators, but can be generalized to many other moves. This PR generalizes this to aggregate construction and many other assignments.
This avoids generating drops that would then be removed by drop elaboration.
This PR changes borrowck behaviour: some programs that were rejected are now accepted, see the last commit. That particular case was wrongly rejected.
Fixes #156713
Based on #158279 to remove a lint false-positive