Skip to content

[Wasm RyuJit] fix validation error in Microsoft.CodeAnalysis.dll - #130579

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-struct-zeroinit-validation-fix
Jul 12, 2026
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-struct-zeroinit-validation-fix

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

For enregistered struct init, retype the zero constant to the local's register type.

For enregistered struct init, retype the zero constant to the local's register type.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings July 12, 2026 15:57
@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 Jul 12, 2026
@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.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

@adamperlin PTAL
fyi @dotnet/wasm-contrib

With this all the CORE_ROOT assemblies crossgen cleanly and validate, except for some non-codegen issue in xunit.runner.utility.netcoreapp10.dll.

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 adjusts JIT lowering for struct local stores so that when a zero-initialization is represented as an int constant (GT_CNS_INT(0)), the constant is retyped to the local’s register type on WASM targets (and continues to do the equivalent retyping for SIMD zeros). This avoids generating IR/codegen patterns that violate WASM’s stricter type validation requirements.

Changes:

  • Introduce a retypeZeroToRegType decision point for GT_CNS_INT(0) struct stores.
  • Keep existing SIMD behavior (create a properly-typed SIMD zero) and extend the same idea for WASM by retyping the zero when lclRegType differs from the constant’s type.
  • Preserve existing behavior for non-WASM targets (except for the small refactor to unify the condition).

@AndyAyersMS
AndyAyersMS merged commit 8ba3455 into dotnet:main Jul 12, 2026
142 checks passed
@AndyAyersMS

Copy link
Copy Markdown
Member Author

The non-codegen (maybe that's debatable) issue is #130585.

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 13, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
…0579)

For enregistered struct init, retype the zero constant to the local's
register type.

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 12, 2026
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

Development

Successfully merging this pull request may close these issues.

3 participants