-
Notifications
You must be signed in to change notification settings - Fork 13.9k
GVN: Bail out if the address cannot be dereferenced. #147844
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
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
if let Value::Address { base, projection, .. } = self.get(value) | ||
&& let Some(value) = self.dereference_address(base, projection) | ||
{ | ||
if let Value::Address { base, projection, .. } = self.get(value) { |
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 don't have a test for projection, but projection should also be able to invalidate values.
@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.
GVN: Bail out if the address cannot be dereferenced.
This comment has been minimized.
This comment has been minimized.
I'm a bit worried we are not addressing the root issue. We can reason with the value behind a reference because it is UB to directly assign to the underlying local while the reference is live. We allow creating new derefs, this means extending the liveness of references, so we are creating UB. Should we just ban introducing new derefs? |
Finished benchmarking commit (c5a0b2c): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient 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 (secondary 3.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -1.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 473.714s -> 474.328s (0.13%) |
Closing in favor of #147886. |
Fixes #141313 and #141313 (comment).
We should always use VnIndex when dereferencing an address in GVN.
r? cjgillot
r? tmiasko (since you found that)