Update GetRangeFromAssertions to handle constants that FitsIn<int32_t>#128935
Draft
tannergooding wants to merge 1 commit into
Draft
Update GetRangeFromAssertions to handle constants that FitsIn<int32_t>#128935tannergooding wants to merge 1 commit into
tannergooding wants to merge 1 commit into
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the JIT’s “range-from-assertions” helper to accept an explicit var_types and to better cope with VN constants that aren’t strictly TYP_INT (notably including integral constants whose value fits in int32_t). The change primarily affects how Assertion Prop queries and consumes inferred ranges.
Changes:
- Extend
RangeCheck::GetRangeFromAssertions/ worker to take an explicitvar_types typeand thread it through recursive calls. - Adjust
GetRangeFromAssertionsWorkerto treat any VN constant specially (return a constant range if it can be represented as anint, otherwise return unknown). - Update Assertion Prop call sites to pass the relevant tree type and to tolerate non-constant ranges (instead of asserting constant-range unconditionally).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/coreclr/jit/rangecheck.h | Updates the GetRangeFromAssertions* signatures to include an explicit var_types type. |
| src/coreclr/jit/rangecheck.cpp | Implements the new signature, updates recursion call sites, and revises constant/type handling in the worker. |
| src/coreclr/jit/assertionprop.cpp | Updates callers to pass types and makes range consumers resilient to non-constant results. |
Comment on lines
+1109
to
+1113
| if (!result.IsConstantRange()) | ||
| { | ||
| assert(varTypeIsLong(vnType)); | ||
| return Limit(Limit::keUnknown); | ||
| } |
Comment on lines
+709
to
+713
| #if TARGET_64BIT | ||
| return Limit(Limit::keUnknown); | ||
| #else | ||
| return GetRangeFromType(TYP_INT); | ||
| #endif |
Comment on lines
+692
to
+693
| // Start with the widest possible constant range. | ||
| return GetRangeFromType(type); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.