Skip to content

Conversation

@EgorBo
Copy link
Member

@EgorBo EgorBo commented Jan 30, 2026

Fixes #123790

For e.g. [0..65535] >> [0..31] I didn't realize I need to swap lower and upper bound for r2, so the result should be:
[0 >> 31 .. 65535 >> 0], not [0 >> 0 .. 65535 >> 31]

No diffs

Copilot AI review requested due to automatic review settings January 30, 2026 11:34
@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 Jan 30, 2026
@dotnet-policy-service
Copy link
Contributor

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

}

// Check if the range represents a single constant value. Example: [7..7]
bool IsSingleConstValue(int* pConstVal) const
Copy link
Member Author

Choose a reason for hiding this comment

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

Two PRs introduced similar helpers, removed one of them.

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 an incorrect range computation in JIT range analysis for right-shift operations (RangeOps::ShiftRight), addressing #123790 and adding a regression test to prevent recurrence.

Changes:

  • Add a JIT regression test for the reported shift/comparison miscompile.
  • Rework RangeOps::ShiftRight to compute bounds using opposite shift-count endpoints (lower uses r2.UpperLimit, upper uses r2.LowerLimit) when the shift-count range is constant and within [0..31].
  • Remove Range::IsSingleConstValue usage in favor of the existing Range::IsSingleValueConstant.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/tests/JIT/Regression/JitBlue/Runtime_123790/Runtime_123790.cs Adds an xUnit regression test for the miscompile scenario from #123790.
src/coreclr/jit/rangecheck.h Updates range computation logic for ShiftRight and replaces IsSingleConstValue references with IsSingleValueConstant.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 30, 2026 11:46
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@EgorBo
Copy link
Member Author

EgorBo commented Jan 30, 2026

/azp run Fuzzlyn

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@EgorBo EgorBo marked this pull request as ready for review January 30, 2026 13:30
@EgorBo
Copy link
Member Author

EgorBo commented Jan 30, 2026

PTAL @jakobbotsch @dotnet/jit-contrib fix for ShiftRight (see description). No diffs.

@EgorBo EgorBo requested a review from jakobbotsch January 30, 2026 13:49
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.

JIT: Wrong result with comparisons

1 participant