-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Delete GTF_INX_REFARR_LAYOUT
#32647
Comments
cc @ivdiazsa |
Looks like one source of collision is |
When morphing This turns out to be safe since in general there is an upstream bounds check to A no diff change would remove the flag and then modify
Removing But there's no good reason to limit the above to ref type arrays Once we do the more general fix we see diffs, so might as well further |
When morphing `GT_INDEX` nodes, we were inadvertently also setting `GTF_IND_NONFAULTING` for the `GT_IND` subtree for ref type arrays, because `GTF_IND_NONFAULTING` has the same value as `GTF_INX_REFARR_LAYOUT`. This turns out to be safe since in general there is an upstream bounds check to cover the null check from the indexing operation, so the fact that we were claiming the `GT_IND` can't fault is ok. A no diff change would remove the `GTF_INX_REFARR_LAYOUT` flag and then modify `fgMorphArrayIndex` to set `GTF_IND_NONFAULTING` for ref type arrays with bounds checks: ``` // If there's a bounds check, the the indir won't fault. if (bndsChk && (tree->gtType == TYP_REF)) { tree->gtFlags |= GTF_IND_NONFAULTING; } tree->gtFlags |= GTF_EXCEPT; ``` But there's no good reason to limit the above change to ref type arrays and no good reason to OR in `GTF_EXCEPT` when there are bounds checks. Once we do the more general fix we see diffs, so we might as well further clean up the related constraint in the importer found under `REDO_RETURN_NODE`. Closes dotnet#32647.
When morphing `GT_INDEX` nodes, we were inadvertently also setting `GTF_IND_NONFAULTING` for the `GT_IND` subtree for ref type arrays, because `GTF_IND_NONFAULTING` has the same value as `GTF_INX_REFARR_LAYOUT`. This turns out to be safe since in general there is an upstream bounds check to cover the null check from the indexing operation, so the fact that we were claiming the `GT_IND` can't fault is ok. A no diff change would remove the `GTF_INX_REFARR_LAYOUT` flag and then modify `fgMorphArrayIndex` to set `GTF_IND_NONFAULTING` for ref type arrays with bounds checks: ``` // If there's a bounds check, the the indir won't fault. if (bndsChk && (tree->gtType == TYP_REF)) { tree->gtFlags |= GTF_IND_NONFAULTING; } tree->gtFlags |= GTF_EXCEPT; ``` But there's no good reason to limit the above change to ref type arrays and no good reason to OR in `GTF_EXCEPT` when there are bounds checks. Closes #32647.
This flag should be no longer needed. Deleting it is causing unexpected assembly diffs that need to be investigated. More context: #32521 (comment)
The text was updated successfully, but these errors were encountered: