Skip to content

JIT: support register-condition SELECT_INC/NEG/INV on arm64 - #135596

Merged
EgorBo merged 1 commit into
dotnet:mainfrom
EgorBo:arm64/fix-134055
Oct 14, 2026
Merged

EgorBo merged 1 commit into
dotnet:mainfrom
EgorBo:arm64/fix-134055

Conversation

@EgorBo

@EgorBo EgorBo commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

When a SELECT keeps a register condition (e.g. a CCMP chain too long for TryLowerConditionToFlagsNode), lowering may still turn it into GT_SELECT_INC/NEG/INV, but LSRA, VisitOperands and codegen (for INC) did not handle these nodes. Also keep the smaller constant as the CINC base in TryLowerCnsIntCselToCinc for GT_SELECT, as done for GT_SELECTCC.

Fixes #134055
Fixes #134056

No diffs

When a SELECT keeps a register condition (e.g. a CCMP chain too long for
TryLowerConditionToFlagsNode), lowering may still turn it into
GT_SELECT_INC/NEG/INV, but LSRA, VisitOperands and codegen (for INC) did
not handle these nodes. Also keep the smaller constant as the CINC base in
TryLowerCnsIntCselToCinc for GT_SELECT, as done for GT_SELECTCC.

Fixes dotnet#134055
Fixes dotnet#134056

Co-authored-by: Copilot <[email protected]>
@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 Oct 11, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 7 pipeline(s).
9 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.

🟢 Approval recommended

The backend changes consistently handle all affected operands, and focused tests cover both condition outcomes and specialized forms.

0 open findings

What changed in this PR

Fixes Arm64 JIT handling of register-conditioned specialized select nodes, preventing LSRA failures and incorrect code generation.

Changes:

  • Adds operand and LSRA support for SELECT_INC/NEG/INV.
  • Corrects CINC base selection and condition consumption.
  • Adds regression coverage for all affected forms.
File Description
src/​coreclr/​jit/​codegenarm64.cpp Consumes register conditions for SELECT_INC.
src/​coreclr/​jit/​compiler.hpp Visits operands of specialized selects.
src/​coreclr/​jit/​lowerarmarch.cpp Keeps the smaller constant as the CINC base.
src/​coreclr/​jit/​lsraarm64.cpp Routes specialized selects through BuildSelect.
src/​coreclr/​jit/​lsraarmarch.cpp Builds condition and value operand uses.
src/​tests/​JIT/​Regression_ro_2/​Runtime_134055.cs Covers register-conditioned increment, negate, and invert selects.

🧠 Review effort: Balanced

@EgorBo

EgorBo commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

PTAL @dotnet/jit-contrib, simple bug-fix, no diffs

@EgorBo
EgorBo requested review from a team and adamperlin October 12, 2026 12:07
@EgorBo

EgorBo commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

PTAL @adamperlin

@EgorBo
EgorBo enabled auto-merge (squash) October 14, 2026 02:18
@EgorBo
EgorBo merged commit 506ef9c into dotnet:main Oct 14, 2026
144 of 146 checks passed
@EgorBo
EgorBo deleted the arm64/fix-134055 branch October 14, 2026 02:18
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 19, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

3 participants