-
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.
Fix problem with fgExpandQmarkForCastInstOf (#97493)
This function expands a nested qmark representing a cast/isinst into multiple blocks of flow. I found a problem, with JitOptRepeat, that exists in non-JitOptRepeat compiles but apparently doesn't lead to problems. The result of the qmark is assigned to a variable. This variable is multiply used during the expansion of the qmarks. This causes problems with subsequent optimizations if the variable already has a known exact type in the importer due to lvaSetClass/lvaUpdateClass. While the variable might have that known type after the full qmark evaluation, it is not guaranteed to have that type in the middle of the evaluation. In particular, the qmark expansion for isinst converts types that don't match the type being tested into null, so the "known type" isn't valid until the value is null. The solution is to create a new temp for the intermediate results, and assign the final result at the end of the expansion. This leads to quite a lot of downstream churn and diffs. E.g., the `fgOptimizeUncondBranchToSimpleCond` optimization doesn't kick in any more on these expansions.
- Loading branch information
1 parent
4d37918
commit f2d5b2f
Showing
2 changed files
with
40 additions
and
28 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