-
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
JIT: Stop sinking stores below commas in impStoreStruct #91586
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThe following logic in the importer creates unnaturally/incorrectly typed runtime/src/coreclr/jit/importer.cpp Lines 962 to 993 in 790c4c0
It changes for instance [000006] --CXG------ ▌ COMMA simd12
[000005] H-CXG------ ├──▌ CALL help int CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE
[000003] ----------- arg0 │ ├──▌ CNS_INT int 0x8A2B390
[000004] ----------- arg1 │ └──▌ CNS_INT int 1
[000001] I---G------ └──▌ IND simd12
[000000] H---------- └──▌ CNS_INT(h) int 0x8601620 static Fseq[s] to [000006] -ACXG------ ▌ COMMA simd12
[000005] H-CXG------ ├──▌ CALL help int CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE
[000003] ----------- arg0 │ ├──▌ CNS_INT int 0x8A2B390
[000004] ----------- arg1 │ └──▌ CNS_INT int 1
[000087] DA--G------ └──▌ STORE_LCL_VAR simd12<System.Numerics.Vector3> V02 tmp1
[000001] I---G------ └──▌ IND simd12
[000000] H---------- └──▌ CNS_INT(h) int 0x8601620 static Fseq[s] We would usually expect runtime/src/coreclr/jit/morph.cpp Lines 9665 to 9669 in 790c4c0
We should fix this; we can likely just avoid sinking these stores below the COMMAs anymore -- this used to be necessary because block morphing did not handle the pattern, but it should be handled after #83590.
|
Morph has post-order logic to compensate for mistyped commas produced by impStoreStruct. However, block morphing can optimize unused stores into INDs; this interacts with the mistyped commas to produce illegal IR shapes (e.g. `COMMA<simd12>(..., IND<ubyte>(...))`). The ideal solution is to fix impStoreStruct (dotnet#91586 tracks this), but this change has a more surgical fix for the problem that can be backported to .NET 8. Fix dotnet#91443
Morph has post-order logic to compensate for mistyped commas produced by impStoreStruct. However, block morphing can optimize unused stores into INDs; this interacts with the mistyped commas to produce illegal IR shapes (e.g. `COMMA<simd12>(..., IND<ubyte>(...))`). The ideal solution is to fix impStoreStruct (#91586 tracks this), but this change has a more surgical fix for the problem that can be backported to .NET 8. Fix #91443
Morph has post-order logic to compensate for mistyped commas produced by impStoreStruct. However, block morphing can optimize unused stores into INDs; this interacts with the mistyped commas to produce illegal IR shapes (e.g. `COMMA<simd12>(..., IND<ubyte>(...))`). The ideal solution is to fix impStoreStruct (#91586 tracks this), but this change has a more surgical fix for the problem that can be backported to .NET 8. Fix #91443
…91718) * JIT: Compensate for mistyped commas in morph pre-order too Morph has post-order logic to compensate for mistyped commas produced by impStoreStruct. However, block morphing can optimize unused stores into INDs; this interacts with the mistyped commas to produce illegal IR shapes (e.g. `COMMA<simd12>(..., IND<ubyte>(...))`). The ideal solution is to fix impStoreStruct (#91586 tracks this), but this change has a more surgical fix for the problem that can be backported to .NET 8. Fix #91443 * Fix build --------- Co-authored-by: Jakob Botsch Nielsen <jakob.botsch.nielsen@gmail.com> Co-authored-by: Jeff Schwartz <jeffschw@microsoft.com>
#106380 is another example of a bug due to this issue.
Another thing is that, since LIR does not support TYP_STRUCT edges beyond some very restricted patterns, we should ensure that the handling for these struct operations properly handle interfering side effects. |
The following logic in the importer creates unnaturally/incorrectly typed
COMMA
nodes:runtime/src/coreclr/jit/importer.cpp
Lines 962 to 993 in 790c4c0
It changes for instance
to
We would usually expect
[000006]
to beTYP_VOID
in the latter tree, as evidenced bygtExtractSideEffList
. Morph also has code to compensate:runtime/src/coreclr/jit/morph.cpp
Lines 9665 to 9669 in 790c4c0
We should fix this; we can likely just avoid sinking these stores below the COMMAs -- this used to be necessary because block morphing did not handle the pattern, but it should be handled after #83590.
#91443 has an example bug because of this JIT IR oddity.
The text was updated successfully, but these errors were encountered: