Skip to content

Fix OperIs(GT_CNS_INT, GT_CNS_LNG) assertion during import#126064

Open
dhartglassMSFT wants to merge 2 commits intodotnet:mainfrom
dhartglassMSFT:antigen_typecheck_fix
Open

Fix OperIs(GT_CNS_INT, GT_CNS_LNG) assertion during import#126064
dhartglassMSFT wants to merge 2 commits intodotnet:mainfrom
dhartglassMSFT:antigen_typecheck_fix

Conversation

@dhartglassMSFT
Copy link
Contributor

@dhartglassMSFT dhartglassMSFT commented Mar 24, 2026

Assertion in gtFoldExprHWIntrinsic on Vector.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

@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 Mar 24, 2026
@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.

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

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 gtFoldExprHWIntrinsic to only fold WithElement when the index operand is an actual integer constant node.
  • Add a new JIT regression test covering Vector256.WithElement with an out-of-range constant index (verifies it throws ArgumentOutOfRangeException).
  • Include the new regression test source file in the Regression_ro_2 test 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.

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.

Assertion 'OperIs(GT_CNS_INT, GT_CNS_LNG)' during intrinsic import

3 participants