Skip to content

JIT: Kill assertions about struct local when skipping field stores in block morph #115556

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

Merged
merged 3 commits into from
May 14, 2025

Conversation

jakobbotsch
Copy link
Member

If we skip storing a field local because we know it is dead, then assertions about the struct local are no longer valid, so invalidate them in that case.

Without this change we could end up using the assertion about the struct local to remove a future store to the particular field, which would leave no zeroing of that field, and would be observable.

Fix #113658

@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 14, 2025
Comment on lines -245 to -246
// Consider doing this for FieldByField as well
//
Copy link
Member Author

Choose a reason for hiding this comment

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

We already do this for the individual fields in that case. And doing it for the base local is unlikely to help anything since the local should be morphed to its fields.

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS @EgorBo

Very minor diffs

@jakobbotsch jakobbotsch requested review from EgorBo and AndyAyersMS May 14, 2025 14:18
@jakobbotsch jakobbotsch merged commit 03635a7 into dotnet:main May 14, 2025
113 of 115 checks passed
@jakobbotsch
Copy link
Member Author

/backport to release/9.0-staging

Copy link
Contributor

Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/15024954839

Copy link
Contributor

@jakobbotsch backporting to "release/9.0-staging" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Avoid removing dead field stores if we generated an assertion
Applying: Kill assertions when skipping field stores instead
error: sha1 information is lacking or useless (src/coreclr/jit/morphblock.cpp).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Kill assertions when skipping field stores instead
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@jakobbotsch
Copy link
Member Author

/backport to release/9.0-staging

Copy link
Contributor

Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/15025151702

Copy link
Contributor

@jakobbotsch backporting to "release/9.0-staging" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Avoid removing dead field stores if we generated an assertion
Applying: Kill assertions when skipping field stores instead
error: sha1 information is lacking or useless (src/coreclr/jit/morphblock.cpp).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Kill assertions when skipping field stores instead
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

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.

Faulty codegen SkipLocalsInit Nullable<T> default value arm64
3 participants