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: Avx.CompareScalar incorrectly folded with True/False comparison modes #125160
CompareScalar is supposed to return the upper elements of the first operand unchanged, but folding for True/False comparison modes returns a full Zero or AllBitsSet vector.
Bug is still present in main at gentree.cpp:35400-35412: for NI_AVX_CompareScalar (and NI_AVX512_CompareMask with a mask retType), the True/False fold replaces the entire tree with gtNewZeroConNode/gtNewAllBitsSetConNode, which is correct for Compare/CompareMask but wrong for CompareScalar (upper elements must be preserved from op1).
A ready-to-go fix exists in #125179 (Copilot SWE agent, March 2026): bail out of the fold for NI_AVX_CompareScalar, and use getSIMDTypeForSize to build the constant when retType is TYP_MASK. The PR went through review feedback from @saucecontrol and @EgorBo, addressed a CI test failure, then was auto-closed after 30 days of inactivity. Worth reviving rather than re-discovering.
Activity
dotnet-policy-service commentedon Mar 4, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
Fix CompareScalar folding with True/False comparison modes and add re…
AndyAyersMS commentedon Jun 6, 2026
Note
AI-assisted (Copilot CLI).
Bug is still present in
mainatgentree.cpp:35400-35412: forNI_AVX_CompareScalar(andNI_AVX512_CompareMaskwith a mask retType), the True/False fold replaces the entire tree withgtNewZeroConNode/gtNewAllBitsSetConNode, which is correct forCompare/CompareMaskbut wrong forCompareScalar(upper elements must be preserved from op1).A ready-to-go fix exists in #125179 (Copilot SWE agent, March 2026): bail out of the fold for
NI_AVX_CompareScalar, and usegetSIMDTypeForSizeto build the constant whenretTypeisTYP_MASK. The PR went through review feedback from @saucecontrol and @EgorBo, addressed a CI test failure, then was auto-closed after 30 days of inactivity. Worth reviving rather than re-discovering.Fix incorrect constant folding of CompareScalar True/False comparisons (
Fix incorrect constant folding of CompareScalar True/False comparisons (