Repository navigation
JIT x64: fix register allocation for Interlocked.Or/And with used result - #138275
Merged
Merged
Conversation
When the result of Interlocked.Or/And is used, the cmpxchg loop needs an internal register. Its use was built after the fixed-RAX def, so a def-use conflict could evict the still-live internal register and reload it into the address register. Fixes dotnet#138258 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 00944461-fda2-4219-ac82-621f01c20bbe
|
Azure Pipelines: Successfully started running 6 pipeline(s). 9 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 |
jakobbotsch
approved these changes
Nov 25, 2026
3 tasks
Member
Author
|
/ba-g deadletter |
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.
Fixes #138258
When the result of
Interlocked.Or/Interlocked.Andis used, xarch emits acmpxchgloop that needs an internal register. LSRA built the internal register use after the fixed-RAX def of the node. When that def has a def-use conflict (e.g. consumed byPUTARG_REGinrdion SysV), LSRA defines it in the use's fixed register, evicting the still-live internal register, which then got "reloaded" into the address register:Checked builds assert
genExactlyOneBit(availableSet)instead. The fix builds internal uses before the def, as other nodes do. Arm64 already uses that order; other targets don't use internal registers here.