Skip to content

[Wasm RyuJit] Match how other targets consume initblk fill values - #129062

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-wasm-initval-leaf-assert-solo
Jun 9, 2026
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-wasm-initval-leaf-assert-solo

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

genConsumeOperands(blkOp) routed the contained GT_INIT_VAL through genConsumeRegs and tripped its OperIsLeaf assert. Replace the call with explicit consume of dest and the unwrapped src, as other targets do.

genConsumeOperands(blkOp) routed the contained GT_INIT_VAL through
genConsumeRegs and tripped its OperIsLeaf assert. Replace the call with
explicit consume of dest and the unwrapped src, as other targets do.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 6, 2026 01:04
@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 Jun 6, 2026
@AndyAyersMS

Copy link
Copy Markdown
Member Author

@dotnet/wasm-contrib PTAL
fyi @dotnet/jit-contrib

Fixes some pri0 asserts (case 2 here: #128234 (comment))

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 updates WASM RyuJIT codegen for GT_STORE_BLK so that when the initblk fill value is wrapped in a contained GT_INIT_VAL, codegen consumes the wrapped value (gtGetOp1()) instead of routing the GT_INIT_VAL wrapper through genConsumeRegs (which asserts on non-leaf contained nodes in codegenlinear.cpp).

Changes:

  • Replace genConsumeOperands(blkOp) with explicit consumption of dest and an unwrapped src when src is a contained GT_INIT_VAL.
  • Add an assertion documenting the invariant that GT_INIT_VAL should be contained in this path.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

@kg can you review?

@AndyAyersMS
AndyAyersMS requested a review from kg June 8, 2026 23:56

@EgorBo EgorBo 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.

I assume whatever (memory.fill ?) we actually generate code for is aware that it needs to only use the 0xFF bits of the init value and the rest can be undefined

@AndyAyersMS

Copy link
Copy Markdown
Member Author

I assume whatever (memory.fill ?) we actually generate code for is aware that it needs to only use the 0xFF bits of the init value and the rest can be undefined

From the wasm spec

The 𝗆𝖾𝗆𝗈𝗋𝗒.𝖿𝗂𝗅𝗅 instruction sets all values in a region of memory to a given byte.

@AndyAyersMS
AndyAyersMS merged commit 062afa5 into dotnet:main Jun 9, 2026
141 checks passed
@pavelsavara pavelsavara added the arch-wasm WebAssembly architecture label Jun 16, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 17, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
…29062)

genConsumeOperands(blkOp) routed the contained GT_INIT_VAL through
genConsumeRegs and tripped its OperIsLeaf assert. Replace the call with
explicit consume of dest and the unwrapped src, as other targets do.

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants