Skip to content

JIT: fix overlap check in store coalescing#128587

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:Fix128566
May 26, 2026
Merged

JIT: fix overlap check in store coalescing#128587
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:Fix128566

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

Ensure the new store fully overlaps the old.

Fixes #128566.

Ensure the new store fully overlaps the old.

Fixes dotnet#128566.
Copilot AI review requested due to automatic review settings May 26, 2026 15:06
@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 May 26, 2026
@AndyAyersMS

Copy link
Copy Markdown
Member Author

@jakobbotsch PTAL
fyi @dotnet/jit-contrib

Should have minimal diffs.

@AndyAyersMS AndyAyersMS requested a review from jakobbotsch May 26, 2026 15:07
@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.

Pull request overview

This PR tightens JIT store-coalescing’s “remove previous store” fast-path so it only fires when the current store fully overwrites the previous store, and adds a regression test reproducing the async/runtime-async miscompile.

Changes:

  • Update LowerStoreCoalescing to require currData.accessSize >= prevData.accessSize (in addition to same offset and type) before deleting the previous store.
  • Add a new async regression test project/source pair for issue 128566.

Reviewed changes

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

File Description
src/coreclr/jit/lower.cpp Fixes the overlap/overwrite check so prior stores aren’t removed unless fully covered by the later store.
src/tests/async/regression/128566.csproj Adds the test project entry for the new regression.
src/tests/async/regression/128566.cs Adds the regression test asserting the struct field is properly zero-initialized.

Comment thread src/tests/async/regression/128566.csproj
@AndyAyersMS

Copy link
Copy Markdown
Member Author

This is hitting the CS8032 error (dotnet/sdk#54350)

@AndyAyersMS

Copy link
Copy Markdown
Member Author

/ba-g sporadic analyzer error

@AndyAyersMS AndyAyersMS merged commit c57d5a1 into dotnet:main May 26, 2026
143 of 147 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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: Store coalescing removes required zeroing

3 participants