Skip to content

JIT: don't contain BITCAST under small local stores - #135595

Merged
EgorBo merged 1 commit into
dotnet:mainfrom
EgorBo:arm64/fix-134054
Oct 13, 2026
Merged

EgorBo merged 1 commit into
dotnet:mainfrom
EgorBo:arm64/fix-134054

Conversation

@EgorBo

@EgorBo EgorBo commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

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

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]>
@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 Oct 11, 2026
@azure-pipelines

Copy link
Copy Markdown
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.

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

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.

🟡 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

@EgorBo

EgorBo commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

PTAL @dotnet/jit-contrib, simple bug-fix, no diffs

@EgorBo
EgorBo requested a review from a team October 12, 2026 12:07
@EgorBo
EgorBo merged commit a920216 into dotnet:main Oct 13, 2026
136 of 138 checks passed
@EgorBo
EgorBo deleted the arm64/fix-134054 branch October 13, 2026 14:15
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 14, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 14, 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.

JIT: (bug) [ARM64] Contained BITCAST in a small (byte/short) STORE_LCL_FLD emits an oversized store and clobbers adjacent fields

3 participants