JIT: Preserve SIMD operand order before morph - #134634
Merged
tannergooding merged 2 commits intoSep 25, 2026
Merged
tannergooding merged 2 commits into
tannergooding merged 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
tannergooding
requested review from
jakobbotsch
and
a lite review from Copilot
September 25, 2026 02:43
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 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 |
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The morph-time assertion may fail when a reverse-flagged HW intrinsic is remorphed.
Review effort: Lite
Findings: None
What changed in this PR
This PR preserves SIMD operand evaluation order during JIT morphing while retaining existing instruction shapes.
Changes:
- Sequences reordered operands with temporaries and
GT_COMMA. - Adds a morph-time HW intrinsic invariant assertion.
- Adds regression coverage for concat and shuffle ordering.
| File | Description |
|---|---|
src/tests/JIT/Regression_ro_2/Runtime_134334.cs |
Adds concat and shuffle evaluation-order regressions. |
src/coreclr/jit/morph.cpp |
Adds the reverse-flag assertion for HW intrinsics. |
src/coreclr/jit/gentree.cpp |
Applies safe SIMD operand sequencing. |
Allow remorph to encounter reordered intrinsics and keep CoreCLR-only regression tests off Mono. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jakobbotsch
approved these changes
Sep 25, 2026
This was referenced Sep 25, 2026
Open
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.
ConcatUpperUpperand variable-index shuffle creation swap SIMD operands to match hardware encodings. Marking those imported trees withGTF_REVERSE_OPSdoes not preserve source evaluation order through morph, which can use a later operand's null check to eliminate a check needed by an earlier call.Use
gtPrepareOperandsForReorderingto sequence the original first operand via a temp andGT_COMMAonly when reordering is observable. This also covers shuffles expanded during rationalization, before tree threading switches to LIR. Retain the existing SIMD instruction shapes and assert that HW intrinsics enter morph without a reverse flag. This is a focused follow-up to #134464.Validation: x64, x86, and ARM64 Debug JIT builds; JIT formatting; three targeted tests pass normally, with MinOpts, AVX2 disabled, hardware intrinsics disabled, and JitStress2. The full merged regression runner reports 423 passed, 0 failed, 7 skipped. Delayed shuffle codegen matches the reverse-flag implementation instruction-for-instruction in the measured 256- and 512-bit cases.
Resolves #134334
Note
This PR description and implementation were prepared with GitHub Copilot assistance.