Skip to content

Simplify intrinsic::raw_eq in MIR when possible#156429

Open
scottmcm wants to merge 2 commits intorust-lang:mainfrom
scottmcm:raw-eq-transmute
Open

Simplify intrinsic::raw_eq in MIR when possible#156429
scottmcm wants to merge 2 commits intorust-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

struct InstSimplifyContext<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
local_decls: &'a LocalDecls<'tcx>,
local_decls: &'a mut IndexVec<Local, LocalDecl<'tcx>>,
Copy link
Copy Markdown
Contributor

@oli-obk oli-obk May 11, 2026

Choose a reason for hiding this comment

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

Suggested change
local_decls: &'a mut IndexVec<Local, LocalDecl<'tcx>>,
local_decls: &'a mut LocalDecls<'tcx>,

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

5 participants