Fix OperIs(GT_CNS_INT, GT_CNS_LNG) assertion during import#126064
Open
dhartglassMSFT wants to merge 2 commits intodotnet:mainfrom
Open
Fix OperIs(GT_CNS_INT, GT_CNS_LNG) assertion during import#126064dhartglassMSFT wants to merge 2 commits intodotnet:mainfrom
dhartglassMSFT wants to merge 2 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a CoreCLR JIT assertion hit during import-time folding of Vector*.WithElement when the index operand is represented as a COMMA node (e.g., a boundscheck sequenced with a constant), and adds a regression test to ensure out-of-range behavior remains correct.
Changes:
- Add an additional operand-shape guard in
gtFoldExprHWIntrinsicto only foldWithElementwhen the index operand is an actual integer constant node. - Add a new JIT regression test covering
Vector256.WithElementwith an out-of-range constant index (verifies it throwsArgumentOutOfRangeException). - Include the new regression test source file in the
Regression_ro_2test project.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/jit/gentree.cpp | Prevents folding WithElement unless the index operand is a constant int node, avoiding an assertion when the index is a COMMA tree. |
| src/tests/JIT/Regression/Regression_ro_2.csproj | Adds the new regression test to the compilation list. |
| src/tests/JIT/Regression/JitBlue/Runtime_126060/Runtime_126060.cs | New regression validating Vector256.WithElement throws on out-of-range index and does not trigger the JIT folding assertion. |
AndyAyersMS
approved these changes
Mar 25, 2026
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.
Assertion in
gtFoldExprHWIntrinsiconVector.WithElement. The index argument could be a COMMA (boundscheck+integral constant) rather than just an integral constant as expected.The windows-x64 antigen runs hit this assert pretty frequently, so fixing here to reduce the noise.
fixes #126060