-
Notifications
You must be signed in to change notification settings - Fork 13.9k
GVN: Invalidate derefs at loop headers #147607
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 |
I want to backport the first two commits. @rustbot label beta-nominated |
3b879e2
to
76422fa
Compare
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.
Thanks for fixing this. I had a more brutal solution in mind, yours preserves more opts.
r=me with some nits
compiler/rustc_middle/src/mir/mod.rs
Outdated
#[path = "loop.rs"] | ||
pub mod loop_; |
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.
#[path = "loop.rs"] | |
pub mod loop_; | |
pub mod loops; |
To avoid having to use a path
attribute.
|
||
let reverse_postorder = body.basic_blocks.reverse_postorder().to_vec(); | ||
for bb in reverse_postorder { | ||
// N.B. With loops, reverse postorder cannot produce a valid topological order. |
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.
Do you mind expanding the comment a bit?
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.
Sorry, but I was expecting something like:
// A statement or terminator from inside the loop, that is not processed yet, may have performed an indirect write.
Just for clarity re. backport: this has been broken since 1.88? What's the benefit of beta backporting? |
76422fa
to
ef51345
Compare
|
||
let reverse_postorder = body.basic_blocks.reverse_postorder().to_vec(); | ||
for bb in reverse_postorder { | ||
// N.B. With loops, reverse postorder cannot produce a valid topological order. |
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.
Sorry, but I was expecting something like:
// A statement or terminator from inside the loop, that is not processed yet, may have performed an indirect write.
// | bb3 | | | ||
// | *x=c | -+ | ||
// +------+ | ||
if maybe_loop { |
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.
Would it be enough to check maybe_loop_headers.contains(bb)
?
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 think so, maybe I'm too conservative.
ef51345
to
2048b9c
Compare
Thanks! |
GVN: Invalidate derefs at loop headers Fix a miscompiled case I found when re-reviewing rust-lang#132527. r? cjgillot r? oli-obk
Rollup of 11 pull requests Successful merges: - #146277 (Enable `u64` limbs in `core::num::bignum`) - #146976 (constify basic Clone impls) - #147249 (Do two passes of `handle_opaque_type_uses_next`) - #147266 (fix 2 search graph bugs) - #147468 (Implement fs api set_times and set_times_nofollow) - #147497 (`proc_macro` cleanups (3/N)) - #147594 (std: implement `pal::os::exit` for VEXos) - #147596 (Adjust the Arm targets in CI to reflect latest changes) - #147607 (GVN: Invalidate derefs at loop headers) - #147620 (Avoid redundant UB check in RangeFrom slice indexing) - #147647 (Hide vendoring and copyright in GHA group) r? `@ghost` `@rustbot` modify labels: rollup
GVN: Invalidate derefs at loop headers Fix a miscompiled case I found when re-reviewing rust-lang#132527. r? cjgillot r? oli-obk
Rollup of 12 pull requests Successful merges: - #146277 (Enable `u64` limbs in `core::num::bignum`) - #146976 (constify basic Clone impls) - #147249 (Do two passes of `handle_opaque_type_uses_next`) - #147266 (fix 2 search graph bugs) - #147497 (`proc_macro` cleanups (3/N)) - #147546 (Suppress unused_parens for labeled break) - #147548 (Fix ICE for never pattern as closure parameters) - #147594 (std: implement `pal::os::exit` for VEXos) - #147596 (Adjust the Arm targets in CI to reflect latest changes) - #147607 (GVN: Invalidate derefs at loop headers) - #147620 (Avoid redundant UB check in RangeFrom slice indexing) - #147647 (Hide vendoring and copyright in GHA group) r? `@ghost` `@rustbot` modify labels: rollup
@rust-timer build 173ae98 |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (173ae98): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking 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. @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)This benchmark run did not return any relevant results for this metric. CyclesResults (primary 2.7%, secondary -2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 475.635s -> 474.033s (-0.34%) |
@bors r- |
@bors retry r- |
Fix a miscompiled case I found when re-reviewing #132527.
r? cjgillot
r? oli-obk