Skip to content

Preserve side effects in SIMD classification helpers - #132921

Open
tannergooding wants to merge 1 commit into
dotnet:mainfrom
tannergooding:tannergooding-investigate-jit-issue-132902
Open

Preserve side effects in SIMD classification helpers#132921
tannergooding wants to merge 1 commit into
dotnet:mainfrom
tannergooding:tannergooding-investigate-jit-issue-132902

Conversation

@tannergooding

Copy link
Copy Markdown
Member

Fixes #132902

SIMD classification helpers that produce constant results now preserve side effects from their operands. This covers all nine affected classification operations rather than only the reported IsInfinity case.

Adds regression coverage using an exception-bearing Vector128.WithElement operand, which exercises the shared x64 and WASM import shape.

Note

This pull request was created with GitHub Copilot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 29, 2026 17:01
@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 Aug 29, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

Review tier: Lite
Findings: None

What changed in this PR

This PR fixes a JIT correctness issue where certain SIMD classification intrinsics could fold to a constant result and inadvertently drop operand side effects (notably exceptions). The fix wraps the folded constant results with extracted side effects from the operand, and adds a targeted regression test to ensure the operand is still evaluated.

Changes:

  • Update JIT SIMD classification helpers to preserve operand side effects when folding to constant results (e.g., integral-type cases).
  • Add a new JIT regression test that validates exception-bearing operands are not elided across nine classification operations.
  • Register the new regression test source file in the merged regression test project.
File Description
src/​coreclr/​jit/​gentree.cpp Wrap constant-folded SIMD classification results with extracted side effects from the operand to prevent eliding exceptions/calls.
src/​tests/​JIT/​Regression/​JitBlue/​Runtime_132902/​Runtime_132902.cs Adds regression coverage using Vector128.WithElement with an out-of-range index to ensure operand exceptions are preserved across classification intrinsics.
src/​tests/​JIT/​Regression/​Regression_ro_2.csproj Includes the new regression test in the merged JIT regression project build.

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.

IsInfinity can drop throwing side effects

2 participants