-
Notifications
You must be signed in to change notification settings - Fork 5.3k
JIT: Recognize both 32->64 bit zero extension patterns for SCEVs #122184
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
Conversation
The JIT has two ways to represent a 32->64 bit zero extension. For array
indexing, for instance, we produce the following:
```
└──▌ IND int <l:$203, c:$143>
└──▌ ARR_ADDR byref int[] $81
└──▌ ADD byref $300
├──▌ LCL_VAR ref V01 arg1 u:1 $100
└──▌ ADD long $282
├──▌ LSH long $281
│ ├──▌ CAST long <- uint $280 <- zero extension
│ │ └──▌ LCL_VAR int V03 loc1 u:3 $241
│ └──▌ CNS_INT long 2 $2c0
└──▌ CNS_INT long 16 $2c2
```
For an explicit zero extension, however, such as when indexing a raw
pointer, we produce the following:
```
├──▌ IND int <l:$142, c:$141>
│ └──▌ ADD long $1c2
│ ├──▌ LCL_VAR long V01 arg1 u:1 $80
│ └──▌ LSH long $1c1
│ ├──▌ CAST long <- ulong <- uint $1c0 <- also a zero extension
│ │ └──▌ LCL_VAR int V04 loc1 u:3 $181
│ └──▌ CNS_INT long 2 $200
```
SCEV analysis did not recognize the latter form as a zero extension.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes SCEV (Scalar Evolution) analysis to recognize both forms of 32-to-64 bit zero extension patterns used by the JIT. Previously, SCEV only recognized CAST long <- uint but not CAST long <- ulong <- uint. The fix adds TYP_ULONG to the cast type check, allowing the analysis to handle both patterns consistently.
Key Change:
- Modified the cast type check in
scev.cppto accept bothTYP_LONGandTYP_ULONGcast types
|
cc @dotnet/jit-contrib |
The JIT has two ways to represent a 32->64 bit zero extension. For array indexing, for instance, we produce the following:
For an explicit zero extension, however, such as when indexing a raw pointer with
ptr[(uint)i], we produce the following:SCEV analysis did not recognize the latter form as a zero extension.
Example:
Before:
After: