Skip to content

[Wasm RyuJit] HW Intrinsic Regalloc: Properly consume temporary from addr operand#131113

Open
adamperlin wants to merge 3 commits into
dotnet:mainfrom
adamperlin:wasm-hwintrinsic-regalloc-fix
Open

[Wasm RyuJit] HW Intrinsic Regalloc: Properly consume temporary from addr operand#131113
adamperlin wants to merge 3 commits into
dotnet:mainfrom
adamperlin:wasm-hwintrinsic-regalloc-fix

Conversation

@adamperlin

Copy link
Copy Markdown
Contributor

This was a bug introduced in #130822; We weren't consuming the multiply-used temporary introduced for null checks on addresses in PackedSimd load_lane/store_lane type operations.

Copilot AI review requested due to automatic review settings July 20, 2026 22:49
@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 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unrelated formatting diff

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 6 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@adamperlin adamperlin added the arch-wasm WebAssembly architecture label Jul 20, 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.

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 Wasm RyuJIT register allocation to consume the temporary register associated with multiply-used address operands on certain hardware intrinsics (to avoid leaving an outstanding temp allocation during reference collection).

Changes:

  • Add logic in WasmRegAlloc::CollectReferencesForHardwareIntrinsic to consume the temporary for a memory address operand.
  • Reformat a couple of long boolean expressions in RangeOps::Add (unrelated to the Wasm change).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/coreclr/jit/regallocwasm.cpp Attempts to consume multiply-used temporaries for HW intrinsic address operands during Wasm regalloc reference collection.
src/coreclr/jit/rangecheck.h Formatting-only line wrapping changes in RangeOps::Add logic.

Comment on lines +731 to +735
GenTree* addr;
if (node->OperIsMemoryLoad(&addr) || node->OperIsMemoryStore(&addr))
{
ConsumeTemporaryRegForOperand(addr DEBUGARG("hardware intrinsic memory address null check"));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is actually fixed in main already, the branch here was just out of date.

Comment thread src/coreclr/jit/rangecheck.h
Comment thread src/coreclr/jit/rangecheck.h
@adamperlin adamperlin closed this Jul 20, 2026
@adamperlin adamperlin reopened this Jul 20, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 6 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI review requested due to automatic review settings July 21, 2026 18:19

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines +731 to +735
GenTree* addr;
if (node->OperIsMemoryLoad(&addr) || node->OperIsMemoryStore(&addr))
{
ConsumeTemporaryRegForOperand(addr DEBUGARG("hardware intrinsic memory address null check"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

2 participants