Ensure that applicable intrinsics have their ranges tracked by vn/assertionprop/rngchk#128722
Ensure that applicable intrinsics have their ranges tracked by vn/assertionprop/rngchk#128722tannergooding wants to merge 6 commits into
Conversation
…ertionprop/rngchk
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR updates CoreCLR JIT range reasoning so that more intrinsic operations contribute consistent non-negative/range information across value numbering, assertion propagation, and range check elimination.
Changes:
- Adds a
ValueNumStorehelper to extract SIMD size/base type from HW-intrinsic VN function apps. - Extends
IsVNNeverNegativeand RangeCheck’s VN-based range extraction to recognize additional HW-intrinsic VNFuncs and bit-counting VNFuncs. - Extends RangeCheck and AssertionProp tree-based range modeling for
GT_INTRINSICandGT_HWINTRINSICbit-counting / extract-msb / element extraction patterns.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/coreclr/jit/valuenum.h | Declares new HW-intrinsic VN helper for SIMD size/base type extraction. |
| src/coreclr/jit/valuenum.cpp | Uses new helper in IsVNNeverNegative and refactors HW-intrinsic VN decoding. |
| src/coreclr/jit/rangecheck.cpp | Adds new intrinsic/HW-intrinsic range modeling in VN-based and tree-based range computation. |
| src/coreclr/jit/assertionprop.cpp | Extends IntegralRange modeling for long constants, primitive intrinsics, and HW intrinsics. |
|
CC. @dotnet/jit-contrib, @EgorBo for review. Another PR around the various range/limit support we have. Diffs are generally positive, with about half of the The general improvements come from us being able to drop otherwise unnecessary casts and a few from redundant comparisons, some of which were found in #128677 and inspired this PR. The For the rest, we had some handling already, and so this merges the Arm64/x64 code paths together to reduce duplication in those spots and is otherwise ensuring consistent handling across the locations that produce range/limit information, as we had a split of the handling before which could cause things to be missed. There is no way for the JIT to determine this range information without us being explicit about it |
Found some cases that were getting pessimized in #128677 because we didn't consistently handle different intrinsics across the various places that can produce range information.