Skip to content

JIT: preserve receiver null checks in tail-recursion optimization - #133868

Closed
EgorBo with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-callvirt-nullcheck
Closed

EgorBo with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-callvirt-nullcheck

Conversation

Copilot AI commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Tail-recursion-to-loop conversion drops GTF_CALL_NULLCHECK on non-virtual callvirt calls, allowing null receivers to silently succeed.

  • JIT: Require !call->NeedsNullCheck() for loop conversion. Otherwise, retain the fast-tail-call path, which emits the receiver null check.
  • Regression coverage: Exercise null and non-null receivers at zero, one, and multiple recursion depths. Disable caller optimization to prevent inlining from masking the bug without suppressing the recursive method’s tail call.

@azure-pipelines

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

@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 Sep 14, 2026
@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.

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix null check in tail-recursion-to-loop conversion JIT: preserve receiver null checks in tail-recursion optimization Sep 14, 2026
Copilot AI requested a review from EgorBo September 14, 2026 13:39
@EgorBo EgorBo closed this Sep 14, 2026
@EgorBo

EgorBo commented Sep 14, 2026

Copy link
Copy Markdown
Member

This fix looks too conservative, probably needs human PR

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

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.

JIT: (bug) Tail-recursion-to-loop conversion drops the callvirt receiver null check

2 participants