Skip to content

Use VN to set initial range in TryGetRangeFromAssertions#119474

Merged
EgorBo merged 3 commits intodotnet:mainfrom
EgorBo:use-vn-in-TryGetRangeFromAssertions
Sep 9, 2025
Merged

Use VN to set initial range in TryGetRangeFromAssertions#119474
EgorBo merged 3 commits intodotnet:mainfrom
EgorBo:use-vn-in-TryGetRangeFromAssertions

Conversation

@EgorBo
Copy link
Member

@EgorBo EgorBo commented Sep 8, 2025

Closes #119466

Diffs

@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 8, 2025
@dotnet-policy-service
Copy link
Contributor

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

@EgorBo EgorBo marked this pull request as ready for review September 9, 2025 11:19
Copilot AI review requested due to automatic review settings September 9, 2025 11:19
Copy link
Contributor

Copilot AI left a comment

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 improves range analysis in the JIT by using value numbering (VN) information to set initial ranges before processing assertions. The change addresses issue #119466 by adding VN-based range initialization to the TryGetRangeFromAssertions method.

Key changes:

  • Added VN-based initial range computation for constants, casts, and array lengths
  • Fixed incorrect range initialization from keDependent/keUndef to keUnknown
  • Removed unnecessary condition check in relational operator folding

Reviewed Changes

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

File Description
src/coreclr/jit/rangecheck.cpp Enhanced TryGetRangeFromAssertions to use VN information for setting initial ranges before assertion processing
src/coreclr/jit/assertionprop.cpp Fixed range initialization to use keUnknown instead of incorrect limit types and removed unnecessary condition

@EgorBo
Copy link
Member Author

EgorBo commented Sep 9, 2025

PTAL @jakobbotsch @dotnet/jit-contrib a small change to set initial Range based on VN in bool RangeCheck::TryGetRangeFromAssertions diffs

@EgorBo EgorBo requested a review from jakobbotsch September 9, 2025 13:45
@EgorBo EgorBo merged commit 3605ab4 into dotnet:main Sep 9, 2025
113 checks passed
@EgorBo EgorBo deleted the use-vn-in-TryGetRangeFromAssertions branch September 9, 2025 14:23
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2025
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.

[JIT] Recognize when length is never negative for Span<T>::.ctor(void*, int32)

3 participants