-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Morph ASG(ONE_FLD_STRUCT, CALL) using BITCAST
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, 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.
- Loading branch information
1 parent
c046354
commit 4974a67
Showing
12 changed files
with
102 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters