-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Wasm various fixes #122627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Wasm various fixes #122627
Conversation
|
@dotnet/jit-contrib PTAL Binning of failures (with this PR) shows mostly NYIs are left: Not focused on success rates just yet as we know things are still incomplete. While fixing some of these will just result in failures popping up elsewhere, we should focus on fixing the biggest bins first when possible. The
Some of the patterns in the fixes below may indicate things we should reconsider, eg perhaps we ought to do the work to remove The handful of bailouts are also food for thought. For example, optimizing a divide via magic shifts and adds may not be worth the trouble, if it increases code size and the underlying engine can do something similar. |
There was a problem hiding this comment.
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 addresses various issues encountered when running WASM JIT compilation on x86 crossgen MCH, focusing on fixing cases where the code didn't handle WASM's unique characteristics (32-bit pointers with 64-bit integer operations).
Key Changes
- Updated constant value accessors to use
IntegralValue()instead of type-specific methods for broader type support - Added
TARGET_WASMguards alongsideTARGET_64BITchecks to prevent WASM from using 32-bit-only helper call paths for 64-bit arithmetic operations - Added LIR-aware code insertion in WASM flow graph transformation to support both statement-based and LIR phases
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/valuenum.cpp | Changed from LngValue() to IntegralValue() for accessing long constants, enabling consistent handling across different integer constant types |
| src/coreclr/jit/morph.cpp | Added TARGET_WASM guards to conditional blocks that previously only checked TARGET_64BIT, preventing WASM from incorrectly using helper calls for long arithmetic; added early exit in fgOptimizeMultiply for TYP_LONG on WASM; updated fgMorphReduceAddOps guard |
| src/coreclr/jit/lower.cpp | Changed from GenTreeIntCon to GenTreeIntConCommon and from IconValue() to IntegralValue() for broader type support; added TARGET_WASM guards for argument lowering; added early return in constant division/modulo optimization for WASM; fixed register type selection for WASM to use TYP_LONG instead of TYP_I_IMPL |
| src/coreclr/jit/gentree.h | Added TARGET_WASM to the conditional that determines when to use indirection cells for R2R calls |
| src/coreclr/jit/fgwasm.cpp | Added LIR-aware code insertion that checks if a block is in LIR form and uses appropriate insertion methods (LIR::Range vs Statement-based) for both control variable assignments and switch dispatch creation |
Here I've tried to fix things that were not NYI's in a replay of the x86 crossgen MCH.