Uh oh!
There was an error while loading. Please reload this page.
Morph ASG(ONE_FLD_STRUCT, CALL) using BITCAST - #61049
Conversation
ghost
commented
Oct 31, 2021
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsLet's see what the CI says about this change. Part of #58312.
|
There are diffs with this change:
|
54e2485 to
bdf28d9Comparebdf28d9 to
e512f20Comparee512f20 to
c72c794Comparec72c794 to
931f571Compare2f6c81a to
6efc97aCompare6efc97a to
5fa597bCompare530e6f2 to
f84b512Compare5bfcaa8 to
3160e39Compare11366bb to
4cc9e1cCompare4cc9e1c to
f2b7c58Compare6701780 to
16c5773Compare16c5773 to
2c0cd3dCompareghost
commented
Apr 29, 2022
This pull request has been automatically marked |
2c0cd3d to
ba64df5Compared4e9ad6 to
b53f19fCompareb53f19f to
521071bComparefc6e496 to
dbf12e3Comparedbf12e3 to
523a150Compare46889ce to
e719865Compare24a6eff to
f202ce7Comparef202ce7 to
0c46158CompareThis changes the representation we have for the special case of assignments from calls that return a struct with one field to a promoted local of that struct type, making it more normal and simplifying the model for SSA and value numbering. In the past, the optimization phases treated this case specially and "skipped" the outer struct local in relevant cases. Instead, I propose a new form for this assignment: ASG(FLD, BITCAST(CALL)), that gets rid of this special-casing, and introduces the useful invariant that if a node has an SSA name, then it always represents a def or use of the corresponding SSA local. After optimizations have done their work, lowering removes the new bitcasts as they do not have meaningful value in the backend. There are some downsides to this representation. For example, if we decide to stop retyping helper calls in the importer, VN will start giving BITCAST VNs to locals assigned values produced by important helpers such as TypeHandleToRuntimeTypeHandle. It makes the IR a bit larger, and, perhaps more importantly, more sparse. I can measure a 0.003% increase in memory consumption when CG-ing x64 CoreLib with this change. There are some TP benefits from the reduced checks too, they may offset this regression. It seems to me that the benefits outweigh the drawbacks in this case.
0c46158 to
4974a67CompareJulieLeeMSFT
commented
Aug 11, 2022
@SingleAccretion, I marked this PR as .NET 8. If you think it should be .NET 7, please let me know. |
This changes the representation we have for the special case of assignments from calls that return a struct with one field
to a promoted local of that struct type, making it more normal and simplifying the model for SSA and value numbering.
In the past, the optimization phases treated this case specially and "skipped" the outer struct local in relevant cases. Instead, I propose a new form for this assignment:
ASG(FLD, BITCAST(CALL)), that gets rid of this special-casing, and introduces the useful invariant that if a node has an SSA name, then it always represents a def or use of the corresponding SSA local.After optimizations have done their work, lowering removes the new bitcasts as they do not have meaningful value in the backend.
There are some downsides to this representation. For example, if we decide to stop retyping helper calls in the importer, VN will start giving BITCAST VNs to locals assigned values produced by important helpers such as
TypeHandleToRuntimeTypeHandle.It makes the IR a bit larger, and, perhaps more importantly, less dense. I can measure a 0.003% increase in memory consumption when CG-ing x64 CoreLib with this change. There are some TP benefits from the reduced checks too, they may offset this regression (my PIN is too noisy to detect anything though :( ).
I posit that the benefits outweigh the drawbacks in this case.
Part of #58312.