-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Regression test for const promotion with Option<Ordering> #145651
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
This comment has been minimized.
This comment has been minimized.
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.
What we are testing here is not really the absence of promoted constants. What we want to test is that both versions produce the same optimized MIR.
tests/mir-opt/pre-codegen/const_promotion_option_ordering_eq.rs
Outdated
Show resolved
Hide resolved
|
r=me once CI passes |
@bors r+ rollup |
Rollup of 12 pull requests Successful merges: - #145651 (Regression test for const promotion with Option<Ordering>) - #145722 (implement Extend<{Group, Literal, Punct, Ident}> for TokenStream) - #146520 (Promote armv8r-none-eabihf target to Tier 2) - #146522 (Promote armv7a-none-eabihf to Tier 2) - #147289 (Mitigate `thread_local!` shadowing issues) - #147515 (Update rustc-perf submodule) - #147522 (compiletest: Use the same directive lines for EarlyProps and ignore/only/needs) - #147525 (Replace locals in debuginfo records during ref_prop and dest_prop) - #147544 (Remove StatementKind::Deinit.) - #147551 (remove `#[rustc_inherit_overflow_checks]` from `is_multiple_of`) - #147553 (Move `wasm32-wasip3` to the tier 3 table) - #147562 (Stabilize `NonZero<u*>::div_ceil`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 12 pull requests Successful merges: - #145651 (Regression test for const promotion with Option<Ordering>) - #145722 (implement Extend<{Group, Literal, Punct, Ident}> for TokenStream) - #146520 (Promote armv8r-none-eabihf target to Tier 2) - #146522 (Promote armv7a-none-eabihf to Tier 2) - #147289 (Mitigate `thread_local!` shadowing issues) - #147515 (Update rustc-perf submodule) - #147522 (compiletest: Use the same directive lines for EarlyProps and ignore/only/needs) - #147525 (Replace locals in debuginfo records during ref_prop and dest_prop) - #147544 (Remove StatementKind::Deinit.) - #147551 (remove `#[rustc_inherit_overflow_checks]` from `is_multiple_of`) - #147553 (Move `wasm32-wasip3` to the tier 3 table) - #147562 (Stabilize `NonZero<u*>::div_ceil`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145651 - borsakv:139093, r=cjgillot Regression test for const promotion with Option<Ordering> https://rust.godbolt.org/z/EjxqE8WcT Fixes #139093 Add a regression test to ensure that comparing `Option<Ordering>` to `Some(Ordering::Equal)` does not trigger unnecessary const promotion in MIR. Previously, inlined constants like `Some(Ordering::Equal)` would get promoted, leading to more complex MIR and redundant LLVM IR checks. This test verifies that both the direct form and the `let`-binding form now generate equivalent, simplified MIR. r? cjgillot
Rollup of 12 pull requests Successful merges: - rust-lang/rust#145651 (Regression test for const promotion with Option<Ordering>) - rust-lang/rust#145722 (implement Extend<{Group, Literal, Punct, Ident}> for TokenStream) - rust-lang/rust#146520 (Promote armv8r-none-eabihf target to Tier 2) - rust-lang/rust#146522 (Promote armv7a-none-eabihf to Tier 2) - rust-lang/rust#147289 (Mitigate `thread_local!` shadowing issues) - rust-lang/rust#147515 (Update rustc-perf submodule) - rust-lang/rust#147522 (compiletest: Use the same directive lines for EarlyProps and ignore/only/needs) - rust-lang/rust#147525 (Replace locals in debuginfo records during ref_prop and dest_prop) - rust-lang/rust#147544 (Remove StatementKind::Deinit.) - rust-lang/rust#147551 (remove `#[rustc_inherit_overflow_checks]` from `is_multiple_of`) - rust-lang/rust#147553 (Move `wasm32-wasip3` to the tier 3 table) - rust-lang/rust#147562 (Stabilize `NonZero<u*>::div_ceil`) r? `@ghost` `@rustbot` modify labels: rollup
https://rust.godbolt.org/z/EjxqE8WcT
Fixes #139093
Add a regression test to ensure that comparing
Option<Ordering>
toSome(Ordering::Equal)
does not trigger unnecessary const promotionin MIR.
Previously, inlined constants like
Some(Ordering::Equal)
would getpromoted, leading to more complex MIR and redundant LLVM IR checks.
This test verifies that both the direct form and the
let
-binding formnow generate equivalent, simplified MIR.
r? cjgillot