Skip to content

Fix RangeOps::Multiply to handle dependent ranges#124533

Merged
EgorBo merged 4 commits intomainfrom
copilot/fix-rangeops-multiply-regression
Feb 19, 2026
Merged

Fix RangeOps::Multiply to handle dependent ranges#124533
EgorBo merged 4 commits intomainfrom
copilot/fix-rangeops-multiply-regression

Conversation

Copy link
Contributor

Copilot AI commented Feb 18, 2026

Description

RangeOps::Multiply was returning keUnknown when either range had dependent bounds, preventing range propagation for loop induction variables. This caused a ~12% regression in CSieve on ARM64.

Changes

Modified RangeOps::Multiply in src/coreclr/jit/rangecheck.h:

  • Preserve existing behavior for fully constant ranges
  • For ranges with dependent bounds: check if constant bound combinations overflow, then return dependent range (not keUnknown)
  • Aligns with Add/Subtract patterns for dependent bound handling

Enables JIT to maintain range information for patterns like:

for (int k = i + i; k <= Size; k += i)
{
    array[k] = value;  // Can now optimize bounds checks
}

Validation

Run CSieve benchmark with EgorBot to confirm regression fix.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh issue view 124349 --json title,body,comments --jq {title, body, comments: [.comments[].body]} (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
@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 Feb 18, 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.

Copilot AI changed the title [WIP] Fix RangeOps::Multiply regression for dependent ranges Fix RangeOps::Multiply to handle dependent ranges Feb 18, 2026
Copilot AI requested a review from EgorBo February 18, 2026 03:40
@EgorBo EgorBo marked this pull request as ready for review February 18, 2026 12:24
Copilot AI review requested due to automatic review settings February 18, 2026 12:24
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

Updates CoreCLR JIT range analysis to avoid immediately giving up on RangeOps::Multiply when inputs are not fully constant, aiming to preserve range propagation for induction-variable patterns and prevent ARM64 CSieve perf regressions.

Changes:

  • Adjusted RangeOps::Multiply to return a range that preserves keDependent on non-constant inputs instead of always returning keUnknown.
  • Kept existing constant-range multiply behavior (including overflow checks) unchanged.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@EgorBo
Copy link
Member

EgorBo commented Feb 19, 2026

PTAL @jakobbotsch @dotnet/jit-contrib fix for a perf regression. Restores back the previous logic to propagate keDependent for MUL.

@EgorBo EgorBo requested a review from jakobbotsch February 19, 2026 12:38
@EgorBo EgorBo merged commit b268dec into main Feb 19, 2026
120 of 125 checks passed
@EgorBo EgorBo deleted the copilot/fix-rangeops-multiply-regression branch February 19, 2026 15:40
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.

3 participants

Comments