-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Some getfield related fixes in inference
#37423
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
Closed
Closed
Conversation
This file contains hidden or 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
* Use the field index passed in in `lift_leaves`
The caller has already done all the computation including bound checking.
The `field` computed in this function is also affecting all the following iterations
which is almost certainly wrong.
* Remove unnecessary type check on `field` in `lift_leaves` since it is always `Int`
* Move a branch disabling `return nothing` higher up
* Remove some duplicated calculation on field index in `getfield_elim_pass!`
* Fix `try_compute_fieldidx` to return `nothing` for non-`Int` `Integer` field index.
This can cause `getfield_nothrow` to return incorrect result.
It also gives the caller worse type info about the return value.
* Teach `getfield_nothrow` that `isbits` field cannot be undefined and getfield on such field cannot throw.
This is already handled in `isdefined_tfunc`.
* Fix a few wrong use of `isbits` in dead branches
----
Ref #26948 (fa02d34)
Ref #27126 (9100329)
e6332b8 to
8a6dae4
Compare
Keno
reviewed
Dec 29, 2020
| typ = compact_exprtype(compact, leaf) | ||
| if !isa(typ, Const) | ||
| # Disabled since #27126 | ||
| return nothing |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I should probably get back to figuring out why this broke.
Keno
approved these changes
Dec 29, 2020
Member
|
Merged in #39036. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
compiler:inference
Type inference
compiler:optimizer
Optimization passes (mostly in base/compiler/ssair/)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use the field index passed in in
lift_leavesThe caller has already done all the computation including bound checking.
The
fieldcomputed in this function is also affecting all the following iterationswhich is almost certainly wrong.
Remove unnecessary type check on
fieldinlift_leavessince it is alwaysIntMove a branch disabling
return nothinghigher upRemove some duplicated calculation on field index in
getfield_elim_pass!Fix
try_compute_fieldidxto returnnothingfor non-IntIntegerfield index.This can cause
getfield_nothrowto return incorrect result.It also gives the caller worse type info about the return value.
Teach
getfield_nothrowthatisbitsfield cannot be undefined and getfield on such field cannot throw.This is already handled in
isdefined_tfunc.Fix a few wrong use of
isbitsin dead branchesRef #26948 (fa02d34)
Ref #27126 (9100329)