Skip to content

Fix JIT over reporting RCPC2 - #135134

Merged
dhartglassMSFT merged 2 commits into
dotnet:mainfrom
dhartglassMSFT:133671
Oct 5, 2026
Merged

dhartglassMSFT merged 2 commits into
dotnet:mainfrom
dhartglassMSFT:133671

Conversation

@dhartglassMSFT

Copy link
Copy Markdown
Contributor

Lowering::TryCreateAddrMode would call compOpportunisticallyDependsOn(InstructionSet_Rcpc2) for volatile loads/stores on ARM64, but could still bail out if, for example, the address offset doesn't fit in 9 bits.

This could cause R2R to over-report needing RCPC2 ISA for methods which didn't end up using the feature

Fix is to move the compOpportunisticallyDependsOn after the eligibility checks in the lowering method. Also needed an explicit bailout for scalar-stores that ended up turning into write-barriers, so we don't report an RCPC2 requirement for this method:

public static void WriteReference(ReferenceField value, object data) => value.Value = data;

The bug is somewhat moot now that RCPC2 is removed from the optimistic arm64 set, but better to fix the over-reporting anyway. Got 0 diffs.

Tested by adding RCPC2 back to the optimistic set and building for linux arm64. The methods from the bug no longer had RCPC2 erroneously reported.

fixes #133671

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

@tannergooding tannergooding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. There's probably a few others like this too, I've seen too many cases of the opportunistic check happening too early relative to its use.

@dhartglassMSFT
dhartglassMSFT enabled auto-merge (squash) October 5, 2026 16:12
@dhartglassMSFT
dhartglassMSFT merged commit 2a4e283 into dotnet:main Oct 5, 2026
146 of 148 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-arm64 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.

[ARM64] R2R methods require RCPC2 without using RCPC2 instructions

3 participants