Repository navigation
JIT: Mark memset/memcpy and monitor helpers as heap-mutating - #136734
Merged
Merged
Conversation
CORINFO_HELP_MEMCPY/MEMZERO/MEMSET/NATIVE_MEMSET write memory but were not marked as mutating the heap, so value numbering, memory liveness and loop side-effect analysis ignored their writes. Loads around them could be CSE'd or hoisted out of loops. Do the same for MON_ENTER/MON_EXIT, which are full memory barriers and write *lockTaken. Co-authored-by: Copilot <[email protected]> Copilot-Session: 6941a5c5-0a5f-4856-a810-37536d3aab5b
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 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 |
Member
Author
|
@dotnet/jit-contrib PTAL, simple correctness fix. |
adamperlin
approved these changes
Oct 30, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CORINFO_HELP_MEMCPY,MEMZERO,MEMSETandNATIVE_MEMSETwrite memory, butHelperCallPropertiesdidn't mark them as mutating the heap. Value numbering, memory liveness and loop side-effect analysis therefore treated them as no-ops for memory, which allowed loads around them to be CSE'd or hoisted out of loops:This PR marks these helpers as heap-mutating.
MON_ENTER/MON_EXITget the same treatment since they are full memory barriers and also write*lockTaken.A couple of diffs