Simplify intrinsic::raw_eq in MIR when possible#156429
Merged
Merged
Conversation
Member
Author
|
r? mir-opt |
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Collaborator
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
oli-obk
reviewed
May 11, 2026
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
May 11, 2026
Simplify `intrinsic::raw_eq` in MIR when possible After #150945 things can inline enough to have this end up specific enough that we can remove it, for example changing `raw_eq::<[u8; 4]>(a, b)` → `Transmute(a) == Transmute(b)`. The LLVM backend can also do this (and in more cases too) but we might as well do it in MIR instead when we can so it applies to all backends and other MIR optimizations can apply afterwards.
Contributor
|
💔 Test for 1991ed3 failed: CI. Failed jobs:
|
Collaborator
|
A job failed! Check out the build log: (web) (plain enhanced) (plain) Click to see the possible cause of the failure (guessed by this bot) |
Member
Author
|
@bors retry (Error response from daemon: Get "https://ghcr.io/v2/": Get "https://ghcr.io/token?account=rust-lang&client_id=docker&offline_token=true&service=ghcr.io": context deadline exceeded (Client.Timeout exceeded while awaiting headers)) |
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
May 11, 2026
Simplify `intrinsic::raw_eq` in MIR when possible After rust-lang#150945 things can inline enough to have this end up specific enough that we can remove it, for example changing `raw_eq::<[u8; 4]>(a, b)` → `Transmute(a) == Transmute(b)`. The LLVM backend can also do this (and in more cases too) but we might as well do it in MIR instead when we can so it applies to all backends and other MIR optimizations can apply afterwards.
This was referenced May 11, 2026
rust-bors Bot
pushed a commit
that referenced
this pull request
May 11, 2026
…uwer Rollup of 11 pull requests Successful merges: - #156448 (miri subtree update) - #155023 (Introduce move expressions (`move($expr)`) ) - #156429 (Simplify `intrinsic::raw_eq` in MIR when possible) - #147672 (LLBC-linker: Do not strip debug symbols for the nvptx target anymore) - #155169 (jsondoclint: simplify code using idiomatic Rust) - #155184 ( Have arrays' `drop_glue` just unsize and call the slice version) - #156022 (rustdoc: Fix cosmetic issues when reporting unresolved paths in `broken_intra_doc_links`) - #156442 (Show intrinsics::gpu in docs) - #156461 (LLVM 23: Specify `returnaddress` intrinsic return type) - #156462 (LLVM 23: Accept float (instead of hex) literals in codegen tests) - #156466 (Refactor `CheckAttrVisitor` so rustfmt can format it.)
rust-timer
added a commit
that referenced
this pull request
May 12, 2026
Rollup merge of #156429 - scottmcm:raw-eq-transmute, r=oli-obk Simplify `intrinsic::raw_eq` in MIR when possible After #150945 things can inline enough to have this end up specific enough that we can remove it, for example changing `raw_eq::<[u8; 4]>(a, b)` → `Transmute(a) == Transmute(b)`. The LLVM backend can also do this (and in more cases too) but we might as well do it in MIR instead when we can so it applies to all backends and other MIR optimizations can apply afterwards.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After #150945 things can inline enough to have this end up specific enough that we can remove it, for example changing
raw_eq::<[u8; 4]>(a, b)→Transmute(a) == Transmute(b).The LLVM backend can also do this (and in more cases too) but we might as well do it in MIR instead when we can so it applies to all backends and other MIR optimizations can apply afterwards.