-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[JIT] ARM32/ARM64 - Fixed zero/sign-extension for GT_STORE_LCL_VAR
in codegen
#84716
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak |
@dotnet/jit-contrib @kunalspathak This is ready pending CI. |
GT_STORE_LCL_VAR
GT_STORE_LCL_VAR
GT_STORE_LCL_VAR
in codegen
What was the underlying problem here (perhaps the one we discussed a while back)? If it was NOL, that implies fixing the "store" part of code is a workaround. |
@SingleAccretion From the issue, we were not zero-extending on store for a NOL, here is the before and after diffs in regards to that example in the issue: |
In principle this should not matter, since upper bits of a NOL local have to be assumed to be random. Is the dump available? |
On x64, we do the zero-extend: mov rax, 0xD1FFAB1E ; data for test.Program:s_2
mov word ptr [rax], 1
movsx rax, word ptr [rax]
neg eax
movzx rcx, al ; <--- zero-extend
and ecx, ecx
call [System.Console:WriteLine(int)]
xor eax, eax |
So this is a variation of the "NOL does not work well with VN" issue. In particular, the problem is how ***** BB01, STMT00002(before)
N005 ( 20, 10) [000013] --CXG------ * CALL void System.Console:WriteLine(int)
N004 ( 6, 7) [000016] ----------- arg0 in x0 \--* CAST int <- ubyte <- int
N003 ( 5, 5) [000012] ----------- \--* AND int
N001 ( 2, 2) [000010] ----------- +--* LCL_VAR int V00 arg0 u:2
N002 ( 2, 2) [000011] ----------- \--* LCL_VAR int V00 arg0 u:2 (last use)
N001 [000010] LCL_VAR V00 arg0 u:2 => <l:$46 {IntCns 255}, c:$200 {$1c0, int <- ubyte <- int}>
N002 [000011] LCL_VAR V00 arg0 u:2 (last use) => <l:$46 {IntCns 255}, c:$200 {$1c0, int <- ubyte <- int}>
N003 [000012] AND => <l:$46 {IntCns 255}, c:$200 {$1c0, int <- ubyte <- int}>
N004 [000016] CAST => <l:$46 {IntCns 255}, c:$201 {$200, int <- ubyte <- int}>
fgCurMemoryVN[GcHeap] assigned for CALL at [000013] to VN: $c1.
N005 [000013] CALL => $VN.Void
***** BB01, STMT00002(after)
N005 ( 20, 10) [000013] --CXG------ * CALL void System.Console:WriteLine(int) $VN.Void
N004 ( 6, 7) [000016] ----------- arg0 in x0 \--* CAST int <- ubyte <- int <l:$46, c:$201>
N003 ( 5, 5) [000012] ----------- \--* AND int <l:$46, c:$200>
N001 ( 2, 2) [000010] ----------- +--* LCL_VAR int V00 arg0 u:2 <l:$46, c:$200>
N002 ( 2, 2) [000011] ----------- \--* LCL_VAR int V00 arg0 u:2 (last use) <l:$46, c:$200> In reality, the value of That said, I would not have objections against merging this change anyway, for consistency between platforms if nothing else (if so, we should also fix LA64 and RISC-V). |
Diffs |
Based on #84693 (comment), does this need to be backported to 7.0? |
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.
I believe you will have to fix the formatting issues before merging.
Yes we should backport this since it is a correctness issue. |
CI failures are unrelated. Merging. |
Resolves #84693
We were not handling zero/sign-extends for NormalizeOnLoad local stores correctly on ARM.