Repository navigation
JIT: don't contain BITCAST under small local stores - #135595
Merged
Merged
Conversation
A small STORE_LCL_VAR/STORE_LCL_FLD implicitly truncates its source, but a contained BITCAST made codegen store directly from the source (e.g. float) register using the full source width, clobbering adjacent fields. Fixes dotnet#134054 Co-authored-by: Copilot <[email protected]>
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The regression test does not cover the affected 16-bit short-store path.
1 open finding
What changed in this PR
Prevents JIT code generation from emitting oversized stores for small locals sourced from contained bitcasts.
Changes:
- Disables bitcast containment for small stores across four architecture backends.
- Adds a regression test for byte-field corruption.
| File | Description |
|---|---|
src/coreclr/jit/lowerxarch.cpp |
Guards x86/x64 bitcast containment. |
src/coreclr/jit/lowerarmarch.cpp |
Guards ARM/ARM64 bitcast containment. |
src/coreclr/jit/lowerloongarch64.cpp |
Guards LoongArch64 bitcast containment. |
src/coreclr/jit/lowerriscv64.cpp |
Guards RISC-V bitcast containment. |
src/tests/JIT/Regression_ro_2/Runtime_134054.cs |
Tests adjacent byte-field preservation. |
🧠 Review effort: Balanced
Member
Author
|
PTAL @dotnet/jit-contrib, simple bug-fix, no diffs |
tannergooding
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

A small STORE_LCL_VAR/STORE_LCL_FLD implicitly truncates its source, but a contained BITCAST made codegen store directly from the source (e.g. float) register using the full source width, clobbering adjacent fields.
Fixes #134054
No diffs