-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Invalidate all dereferences when encountering non-local assignments #132527
base: master
Are you sure you want to change the base?
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[WIP] Invalidate all dereferences when encountering non-local assignments Fixes rust-lang#132353. r? ghost
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (0011660): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.1%)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.
CyclesResults (primary -1.6%)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.
Binary sizeResults (primary -0.1%, secondary -0.3%)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.
Bootstrap: 780.173s -> 782.091s (0.25%) |
I will update this after #132461. |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
☔ The latest upstream changes (presumably #133841) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
[WIP] Invalidate all dereferences when encountering non-local assignments Fixes rust-lang#132353. r? ghost
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
☔ The latest upstream changes (presumably #134330) made this pull request unmergeable. Please resolve the merge conflicts. |
199b7f9
to
fbe5924
Compare
I rebased. |
} | ||
// Function calls maybe invalidate nested deref, and non-local assignments maybe invalidate deref. | ||
// Currently, no distinction is made between these two cases. | ||
self.invalidate_derefs(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fear we are missing many cases of indirect writes. For example, inline asm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of addressing to which terminator may write something, I adopted a more conservative approach, which terminator must not write anything.
@bors r- |
@rustbot ready |
☔ The latest upstream changes (presumably #135592) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #135753) made this pull request unmergeable. Please resolve the merge conflicts. |
I think I'll leave it to the expert who keeps finding things I missed ;) |
Fixes #132353.
This PR removes the computation value by traversing SSA locals through
for_each_assignment_mut
.Because the
for_each_assignment_mut
traversal skips statements which have side effects, such as dereference assignments, the computation may be unsound. Instead offor_each_assignment_mut
, we compute values by traversing in reverse postorder.Because we compute and use the symbolic representation of values on the fly, I invalidate all old values when encountering a dereference assignment. The current approach does not prevent the optimization of a clone to a copy.
In the future, we may add an alias model, or dominance information for dereference assignments, or SSA form to help GVN.
r? cjgillot
cc @jieyouxu #132356
cc @RalfJung #133474