-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fold primitive-typed access to promoted structs in local morph and fo…
…rbid mismatched struct assignments (#76766) * GenTree::GetLayout field FIELDs * Do not create invalid IR when replacing promoted fields Instead, create constructions like "OBJ(ADDR(LCL_VAR))" that block morphing can recognize on its own. * Delete lvFieldHnd * GenTree::GetLayout - CALL/COMMA * GenTreeHWIntrinsic::GetLayout * Add an assert that LHS and RHS match * Fix assert violation And simplify the code... * Delete RetypedAsScalarFieldsMap Without handle equality, the assert no longer holds, for example: ```cs private StructWithInt Problem(StructWithInt b, StructWithInt a) { a = ((StructWithStructWithInt*)&b)->StructWithInt; return a; } ``` * Delete a bit of code Dead / unncessary. No diffs. * Fold promoted locals in local morph * Support GT_IND in MorphStructField This is significantly simpler than moving the promotion logic to post-order because we don't need to fiddle with the ref counting process and complexities of intermediate states, e. g. "IND<float>(ADDR(FIELD<int>(ADDR(LCL_VAR<struct>))))" can be naturally turned into "BITCAST<float>(LCL_VAR<int>)" like this. * More code removal * Move "fgMorphStructField" to local morph * TP tuning With this, we have only a very small regression: Base: 1297463478, Diff: 1297750893, +0.0222% LocalAddressVisitor::MorphStructField : 345099 : NA : 31.52% : +0.0266% LocalAddressVisitor::PreOrderVisit : 224684 : +3.53% : 20.52% : +0.0173% memset : 88591 : +0.99% : 8.09% : +0.0068% Compiler::fgMorphSmpOp : -19170 : -0.06% : 1.75% : -0.0015% Compiler::fgMorphStructField : -367474 : -100.00% : 33.56% : -0.0283% (This is with a dummy field on LclVarDsc) Losing the assert does not seem worrysome as we have an identical one in "fgMorphField".
- Loading branch information
1 parent
41db775
commit 76cf397
Showing
8 changed files
with
168 additions
and
312 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
Oops, something went wrong.