Skip to content

JIT: Make GenTreeCall::Equals compare gtCallMoreFlags and more - #130811

Merged
AndyAyersMS merged 3 commits into
dotnet:mainfrom
AndyAyersMS:jit-call-compare-semantics
Jul 16, 2026
Merged

AndyAyersMS merged 3 commits into
dotnet:mainfrom
AndyAyersMS:jit-call-compare-semantics

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

We may inadvertently merge calls that would behave differently at runtime, eg null-check vs non-null-check. Compare all the call more flags and other call metadata that may vary.

We may inadvertently merge calls that would behave differently at runtime,
eg null-check vs non-null-check. Compare all the call more flags and
other call metadata that may vary.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings July 15, 2026 19:19
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 15, 2026
@AndyAyersMS

Copy link
Copy Markdown
Member Author

Around 200 diffs, mostly merging null check vs non-null check calls.

@jakobbotsch PTAL
fyi @dotnet/jit-contrib

@azure-pipelines

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

@AndyAyersMS
AndyAyersMS requested a review from jakobbotsch July 15, 2026 19:20
@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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens GenTreeCall::Equals so call-node equality checks incorporate additional call semantics (flags and metadata), reducing the risk of incorrectly treating semantically-different calls as identical during tree comparisons.

Changes:

  • Add ReturnTypeDesc::Equals to enable structured comparisons of multi-reg return descriptors.
  • Expand GenTreeCall::Equals to compare additional call semantics (selected gtFlags, all gtCallMoreFlags, return type metadata, async metadata, and argument signature metadata/layout compatibility).
  • Improve ReadyToRun entrypoint equality checks by comparing full CORINFO_CONST_LOOKUP (not just addr).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/coreclr/jit/gentree.h Adds ReturnTypeDesc::Equals for comparing multi-reg return descriptors (and field offsets on RISC-V/LoongArch).
src/coreclr/jit/gentree.cpp Broadens GenTreeCall::Equals to include more semantic metadata in call equality decisions.

Comment thread src/coreclr/jit/gentree.cpp Resolved
Comment thread src/coreclr/jit/gentree.cpp Resolved
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 5d730a5b-5d90-4d97-9a4d-cd0ed578ef55
Copilot AI review requested due to automatic review settings July 15, 2026 22:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/coreclr/jit/gentree.cpp Resolved
@AndyAyersMS

Copy link
Copy Markdown
Member Author

Tempted to also tack on a fix for #128659.

Comment thread src/coreclr/jit/gentree.cpp Resolved
Comment thread src/coreclr/jit/gentree.cpp Resolved

@tannergooding tannergooding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks functionally correct to me and like we're meaningfully comparing the fields.

That being said, it might be goodness to explicitly call out the ones we aren't comparing and why that's ok as it will help ensure we've not missed one of the several union fields or special cases that could be impactful.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

diffs

Comment thread src/coreclr/jit/gentree.cpp Resolved
Comment thread src/coreclr/jit/gentree.cpp Resolved
Comment thread src/coreclr/jit/gentree.cpp Resolved
Comment thread src/coreclr/jit/gentree.cpp Resolved
Comment thread src/coreclr/jit/gentree.cpp Resolved
Comment thread src/coreclr/jit/gentree.cpp Resolved
Comment thread src/coreclr/jit/gentree.h Resolved
Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings July 16, 2026 18:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

revised diffs

Blocks tail merges in some cases, so code is a bit larger.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

/ba-g all legs green but build analysis stuck

@AndyAyersMS
AndyAyersMS merged commit 475838a into dotnet:main Jul 16, 2026
140 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 17, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR 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.

4 participants