Skip to content

JIT: Include kmov instructions in an encoding assert - #119579

Merged
jakobbotsch merged 1 commit into
dotnet:mainfrom
jakobbotsch:fix-118921
Sep 11, 2025
Merged

jakobbotsch merged 1 commit into
dotnet:mainfrom
jakobbotsch:fix-118921

Conversation

@jakobbotsch

Copy link
Copy Markdown
Member

We can get here for kmov instructions. On x64 the above check for EA_PTRSIZE will make the assert pass, but for x86 the assert fails.

This just includes the kmov instructions like @tannergooding suggested here: #118921 (comment)

I verified that the produced codegen looks reasonable: we see kmovq k1, qword ptr [eax+0x10] and corresponding kmovq qword ptr [eax+0x10], k1 when moving the mask local between heap and local because of the async suspension.

Fix #118921

We can get here for kmov instructions. On x64 the above check for
`EA_PTRSIZE` will make the assert pass, but for x86 the assert fails.
Copilot AI review requested due to automatic review settings September 11, 2025 13:53
@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 Sep 11, 2025

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.

Pull Request Overview

This PR fixes an assertion failure that occurs when the JIT encounters kmov instructions on x86. The issue was that kmov instructions can have EA_8BYTE size attributes even on x86, causing an existing assert to fail which expected only certain instruction types to reach that code path.

  • Updated the encoding assert to include kmov instructions as a valid case
  • Allows kmov instructions to pass through the encoding path without triggering assertion failures

Comment thread src/coreclr/jit/emitxarch.cpp Resolved
@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.

@tannergooding tannergooding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Longer term I'd still like to see if we can simplify emitInsSizeAM to just reuse the same logic as the other paths do via emitInsSize instead. But that's a more involved change.

@jakobbotsch
jakobbotsch merged commit f12390d into dotnet:main Sep 11, 2025
@jakobbotsch
jakobbotsch deleted the fix-118921 branch September 11, 2025 17:18
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 2025
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