[release/11.0] Fix SIMD primitive zero initialization - #133168
Merged
Conversation
`TryPrimitiveInit` created a SIMD zero node when converting a zero block initialization into a primitive local store, but the rationalized store retained its original integer-zero data node. This produced a SIMD store with an integer source, leading to invalid codegen and Tier0 compilation failures. The missing source replacement was introduced by the assignment rationalization changes in #85585 (`53b4cd0912d`), where the legacy `GT_ASG` path updated `gtOp2` but the rationalized store path did not update `Data()`. Before the fix, the `Vector256` case encoded `C4 E1 FD 6E C0` (`vmovq` with `VEX.L=1`). The corrected tree emits a SIMD zero (`vxorps`) in both FullOpts and Tier0. Regression coverage includes `Vector128` and `Vector256` in both modes. Fixes #133085 > [!NOTE] > This pull request description was generated with GitHub Copilot. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Member
|
@EgorBo, please review this servicing PR. |
EgorBo
approved these changes
Sep 3, 2026
Member
|
/ba-g helix monitor timeout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #133100 to release/11.0
/cc @tannergooding
Customer Impact
Reported in #133085. Zero-initializing a struct through a byref that the JIT can see is the address of a
Vector128<T>/Vector256<T>local (Unsafe.As<Vector256<ulong>, S>(ref v) = default;) produces a SIMD store whose source is an integer zero constant. With optimizations that lowers tovmovq ymm0, rax(C4 E1 FD 6E C0), which has no valid VEX.256 encoding, so the process dies withExecutionEngineException: Illegal instruction; at Tier0 the same method fails to compile and throwsInvalidProgramException. Expected behavior is a SIMD zero (vxorps) in both modes.The pattern shows up in code that reinterprets vector locals as multi-limb structs, and there is no compile-time diagnostic — it fails at runtime on any AVX-capable x64 machine.
Regression
Not a regression in 10.0 or 11.0 — .NET 9 fails the same way. The bad tree dates to the assignment rationalization work in #85585 (
53b4cd0912d), where the legacyGT_ASGpath updatedgtOp2but the rationalized store path never updatedData().Testing
New regression test
src/tests/JIT/Regression/JitBlue/Runtime_133085, coveringVector128<ulong>andVector256<ulong>in both FullOpts (AggressiveOptimization) and Tier0. It reproduces the illegal encoding /InvalidProgramExceptionwithout the fix and passes with it.Missed previously because
TryPrimitiveInitlooked correct in isolation — it built the SIMD zero node and assigned it tom_src— and no existing test zero-initialized a SIMD local through a reinterpreted struct view, so nothing exercised the path where the store's data operand still had to be replaced.Risk
Low. Two lines in
TryPrimitiveInit, reached only when a block zero-init of a SIMD-typed local is converted into a primitive store. It makes the store's data node match the store's type, which is what the transform already intended; every other case was already consistent.Note
This pull request description was generated with GitHub Copilot.