-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix unsound optimization with explicit variant discriminants #89489
Conversation
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
fa460be
to
529c353
Compare
lgtm, tho we should do some cleanups of the opt after this is merged r? @tmiasko for another pair of eyes |
The change seems reasonable. At the same time I can't really follow the preexisting implementation. Why the left hand side of the assignment is ignored for the purposes of the comparison? How do we know that place that we read the discriminant from still holds the same value? |
@tmiasko so I guess let's disable the opt in addition to this fix until we have a clearer picture of how it works? |
Sounds good to me. |
@FabianWolff please also add an early abort in the mir opt with
so that we don't run the opt at all in normal mode |
@oli-obk Done. |
@bors r=oli-obk p=1 Fixes P-critical issue. |
📌 Commit dd9b476 has been approved by |
Beta nominating so we can get this fix out sooner. The most important change is that we've disabled the pass by default which is safe and should be very easy to backport. |
⌛ Testing commit dd9b476 with merge a6bea3af357e9103d5a9470030a30980f63deed3... |
Should this be backported to stable? |
@@ -0,0 +1,18 @@ | |||
// Regression test for issue #89485. |
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 it would be a good idea to add a copy of this test with -Zunsound-mir-opts
enabled
💥 Test timed out |
@bors retry |
☀️ Test successful - checks-actions |
It's a good question @nbdd0121 . IMO, since we're about 1.5 weeks from the next release, beta backport seems sufficient to me. |
Finished benchmarking commit (a479766): comparison url. Summary: This change led to small relevant regressions 😿 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
@rustbot label: +perf-regression-triaged we disabled an unsound MIR opt. LLVM can't figure this out on its own sadly. |
[beta] backports - 2229: Consume IfLet expr rust-lang#89282 - Wrapper for -Z gcc-ld=lld to invoke rust-lld with the correct flavor rust-lang#89288 - Fix unsound optimization with explicit variant discriminants rust-lang#89489 - Fix stabilization version for bindings_after_at rust-lang#89605 - Turn vtable_allocation() into a query rust-lang#89619 - Revert "Stabilize Iterator::intersperse()" rust-lang#89638 - Ignore type of projections for upvar capturing rust-lang#89648 - ~~Add Poll::ready and~~ revert stabilization of task::ready! rust-lang#89651 - CI: Use mirror for libisl downloads for more docker dist builds rust-lang#89661 - Use correct edition for panic in [debug_]assert!(). rust-lang#89622 - Switch to our own mirror of libisl plus ct-ng oldconfig fixes rust-lang#89599 - Emit item no type error even if type inference fails rust-lang#89585 - Revert enum discriminants rust-lang#89884
Fixes #89485.