Visitar URL original
JIT: Keep index casts available for address-mode optimization by NinoFloris · Pull Request #137513 · dotnet/runtime · GitHub
Skip to content

JIT: Keep index casts available for address-mode optimization - #137513

Open
NinoFloris wants to merge 1 commit into
dotnet:mainfrom
NinoFloris:jit/cse-addrmode-index-cast
Open

NinoFloris wants to merge 1 commit into
dotnet:mainfrom
NinoFloris:jit/cse-addrmode-index-cast

Conversation

@NinoFloris

@NinoFloris NinoFloris commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Extend GTF_ADDRMODE_NO_CSE marking to unchecked (int or smaller)-to-native-int casts beneath scaled and unscaled indices on xarch and arm64. This keeps the casts available for lowering to eliminate or fold into the address instead of materializing CSE temps. Marking is per occurrence, so non-address uses remain eligible for CSE.

RISC-V already has a similar rule:
https://github.com/NinoFloris/dotnet-runtime/blob/ad5df9d0712b11c81f78e36519429576b33c1451/src/coreclr/jit/gentree.cpp#L5965-L5986

CI results, aggregated across collections. PerfScore is the geomean over all paired compilations; lower is better in every column.

Platform TP Code size PerfScore (geomean)
Linux x64 −0.015% −21,303 B −0.002%
Windows x64 −0.021% −32,819 B −0.001%
Linux arm64 −0.028% −129,808 B −0.007%
Windows arm64 −0.026% −120,840 B −0.007%
macOS arm64 −0.028% −15,572 B −0.005%
Linux arm 0.000% 0 B 0.000%
Windows x86 +0.003% 0 B 0.000%
Wasm 0.000% 0 B 0.000%

@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 Nov 13, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Nov 13, 2026
@azure-pipelines

Copy link
Copy Markdown
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.

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

@NinoFloris
NinoFloris force-pushed the jit/cse-addrmode-index-cast branch from ad5df9d to e6a951a Compare November 13, 2026 19:40
@NinoFloris
NinoFloris marked this pull request as ready for review November 13, 2026 21:07
@NinoFloris
NinoFloris force-pushed the jit/cse-addrmode-index-cast branch from e6a951a to 18f6da9 Compare November 13, 2026 21:15
Keep unchecked int-to-native-int casts in scaled and unscaled address indices out of CSE so lowering can eliminate or fold them. On xarch, only zero-extending casts qualify; arm64 also supports sign extension in its address forms. Marking is per occurrence, so non-address uses remain eligible for CSE.

This branch has not been deployed

No deployments
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 community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant