You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: (bug) [ARM64] TryLowerCnsIntCselToCinc keeps the wrong constant as the CINC base and produces an unusable GT_SELECT_INC #134055
On arm64, TryLowerCnsIntCselToCinc converts a register-conditioned GT_SELECT of two adjacent constants into GT_SELECT_INC, which LSRA cannot build (Checked assert, silent MinOpts fallback in Release). The GT_SELECT branch also keeps the larger constant as the CINC base, unlike the GT_SELECTCC branch.
The 12-element & chain is required so the CCMP walk-back exceeds the 10-node limit in TryLowerConditionToFlagsNode and the node stays a register-condition GT_SELECT.
Expected
5 4, compiled with FullOpts into a csinc-style sequence (~84 bytes, as in the ? 7 : 4 control case).
Actual
Checked arm64:
Assertion failed '(kind & GTK_SMPOP) != 0' in 'Prog:Test(int):int' during 'Linear scan register alloc'
File: src/coreclr/jit/lsrabuild.cpp:4221
With DOTNET_JitDump an earlier '!"unhandled special node"' assert fires in compiler.hpp:4448.
Release arm64 silently abandons FullOpts and re-jits with MinOpts: 228 bytes vs 84 bytes for the ? 7 : 4 control case. Same MinOpts cliff on shipped .NET 10.0.9.
Notes
lowerarmarch.cpp, TryLowerCnsIntCselToCinc, GT_SELECT branch: with op1Val = 5, op2Val = 4, shouldReverseCondition is false, gtOp2 (4) is removed and gtOp1 (5) stays as the CINC base, so genCodeForSelect would emit cond ? 6 : 5. The GT_SELECTCC branch just below does the required std::swap(gtOp1, gtOp2); the GT_SELECT branch does not. This wrong value is currently masked
because GT_SELECT_INC is GTK_SPECIAL and never survives LSRA (see the related register-condition
CSOp contract issue), but fixing only the backend would turn it into silent wrong code.
Activity
dotnet-policy-service commentedon Sep 16, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JIT: support register-condition SELECT_INC/NEG/INV on arm64 (#135596)