-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[NativeAOT/arm32] punning test failure in Checked build #98493
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThe following test fails in Checked builds: runtime/src/tests/Loader/classloader/Casting/punning.cs Lines 57 to 69 in fa3dccb
with the following stack trace:
The address 0x007513da is a fat pointer (notice that the bit 2 is set on the address). The optimized code strips away the far pointer invocation (at address 0x65fd44):
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsThe following test fails in Checked builds: runtime/src/tests/Loader/classloader/Casting/punning.cs Lines 57 to 69 in fa3dccb
with the following stack trace:
The address 0x007513da is a fat pointer (notice that the bit 2 is set on the address). The optimized code strips away the far pointer invocation (at address 0x65fd44):
|
Moving this to the JIT are path. For some reason we're ending up optimizing out the fat call check. Here's the JitDump for ARM32: And here's another one for x64: Notice what we did with STMT00018 in the ARM32 case: At some point we turn it from
Into
And then it gets optimized away completely for obvious reasons. I think value numbering is to blame. In the x64 case we have:
Whereas in the Arm32 case we have:
I wonder if this is one of those "treating a handle as an integer constant" things. |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThe following test fails in Checked builds: runtime/src/tests/Loader/classloader/Casting/punning.cs Lines 57 to 69 in fa3dccb
with the following stack trace:
The address 0x007513da is a fat pointer (notice that the bit 2 is set on the address). The optimized code strips away the far pointer invocation (at address 0x65fd44):
|
May not be exactly the right fix, but preventing constant folding of the AND with handle seems to do the trick: --- a/src/coreclr/jit/valuenum.cpp
+++ b/src/coreclr/jit/valuenum.cpp
@@ -4421,6 +4421,11 @@ bool ValueNumStore::VNEvalCanFoldBinaryFunc(var_types type, VNFunc func, ValueNu
case GT_RSZ:
case GT_ROL:
case GT_ROR:
+ if (IsVNHandle(arg0VN) || IsVNHandle(arg1VN))
+ {
+ return false;
+ }
+ break;
case GT_EQ:
case GT_NE:
(or rather |
The following test fails in Checked builds:
runtime/src/tests/Loader/classloader/Casting/punning.cs
Lines 57 to 69 in fa3dccb
with the following stack trace:
The address 0x007513da is a fat pointer (notice that the bit 2 is set on the address). The optimized code strips away the far pointer invocation (at address 0x65fd44):
The text was updated successfully, but these errors were encountered: