GVN: Don't assume nested shared references are read-only.#157346
GVN: Don't assume nested shared references are read-only.#157346dianqk wants to merge 2 commits into
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
@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: Don't assume nested shared references are read-only.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0eeeb18): 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 3.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -0.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 509.701s -> 512.229s (0.50%) |
| // DO NOT reason the pointer value that has references. | ||
| // We cannot unify two pointers that dereference same local, because they may | ||
| // have different lifetimes. |
There was a problem hiding this comment.
This isn't quite grammatical. Maybe you mean "do not reason about ..."? But even then I'm a bit confused about what the comment is trying to say.
This should definitely mention that nested shared references are not read-only and have a link to the issue.
| // let c: &T = *a; | ||
| // ``` | ||
| if projection_ty.ty.is_ref() { | ||
| // Unifying them can violate Stacked Borrows or Tree Borrows. |
There was a problem hiding this comment.
| // Unifying them can violate Stacked Borrows or Tree Borrows. | |
| // Furthermore, unifying them can also violate Stacked Borrows or Tree Borrows. |
Fixes #155884.
#150485 only checks the type, whether it is a reference, which is not enough. The PR extends to other types.
cc @RalfJung @saethlin
r? @cjgillot