Skip to content

Simplify intrinsic::raw_eq in MIR when possible#156429

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
scottmcm:raw-eq-transmute
May 12, 2026
Merged

Simplify intrinsic::raw_eq in MIR when possible#156429
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
scottmcm:raw-eq-transmute

Conversation

@scottmcm
Copy link
Copy Markdown
Member

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.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 11, 2026
@scottmcm
Copy link
Copy Markdown
Member Author

r? mir-opt

@scottmcm scottmcm marked this pull request as ready for review May 11, 2026 04:09
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 11, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 11, 2026

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 11, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 11, 2026

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 19 candidates

Comment thread compiler/rustc_mir_transform/src/instsimplify.rs
@JohnTitor JohnTitor removed their assignment May 11, 2026
Copy link
Copy Markdown
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 11, 2026

📌 Commit c468ee3 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 11, 2026
@rust-bors

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.
@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 11, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 11, 2026

💔 Test for 1991ed3 failed: CI. Failed jobs:

@rust-log-analyzer
Copy link
Copy Markdown
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)
##[endgroup]
Image input checksum 8fe117101010f8822f8547370f0fe29b5e9aae9ec788335c3294c5971797140ca1d0dfa0c1caf38c876f669e84123f603a0e01a5ed78c9a9d623c58be2bccb86
##[group]Building docker image for dist-powerpc64le-linux-gnu
Docker version 28.0.4, build b8034c0
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) (Client.Timeout exceeded while awaiting headers)
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"
echo "disk usage:"
df -h
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}

@scottmcm
Copy link
Copy Markdown
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))

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 11, 2026
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.
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-bors rust-bors Bot merged commit f91de35 into rust-lang:main May 12, 2026
11 of 12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 12, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants