Skip to content

[Experiment] JIT: fold reference equality for provably unrelated types - #133258

Closed
EgorBo wants to merge 3 commits into
dotnet:mainfrom
EgorBo:jit-fold-unrelated-ref-eq
Closed

[Experiment] JIT: fold reference equality for provably unrelated types#133258
EgorBo wants to merge 3 commits into
dotnet:mainfrom
EgorBo:jit-fold-unrelated-ref-eq

Conversation

@EgorBo

Copy link
Copy Markdown
Member
boolFoo(ClassAa,ClassBb){if(a!=null){returnobject.ReferenceEquals(a,b);}returnfalse;}
- test rcx, rcx- je SHORT G_M47830_IG05- cmp rcx, rdx- sete al- movzx rax, al- ret- xor eax, eax- ret+ xor eax, eax+ ret

If one operand has an exact class handle that is provably not castable to the
other operand's class, and at least one of them is known to be non-null, then
the two references can never point to the same object - fold GT_EQ to false and
GT_NE to true in global assertion prop.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1c285c82-a3d6-473d-b94c-84e9d30b226f
@EgorBo

Copy link
Copy Markdown
MemberAuthor

@MihuBot -nuget

@github-actionsgithub-actionsBot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 4, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

EgorBoand others added 2 commits September 4, 2026 22:14
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1c285c82-a3d6-473d-b94c-84e9d30b226f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1c285c82-a3d6-473d-b94c-84e9d30b226f
@EgorBo

Copy link
Copy Markdown
MemberAuthor

@MihuBot -nuget

@EgorBo

Copy link
Copy Markdown
MemberAuthor

diffs aren't motivating

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

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@EgorBo