-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Some getfield
related fixes in inference
#37423
Closed
Closed
Conversation
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
yuyichao
added
compiler:inference
Type inference
compiler:optimizer
Optimization passes (mostly in base/compiler/ssair/)
labels
Sep 6, 2020
* 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)
yuyichao
force-pushed
the
yyc/typeinf/getfield
branch
from
September 6, 2020 04:13
e6332b8
to
8a6dae4
Compare
Keno
reviewed
Dec 29, 2020
@@ -342,22 +340,22 @@ function lift_leaves(compact::IncrementalCompact, @nospecialize(stmt), | |||
else | |||
typ = compact_exprtype(compact, leaf) | |||
if !isa(typ, Const) | |||
# Disabled since #27126 | |||
return nothing |
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
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_leaves
The caller has already done all the computation including bound checking.
The
field
computed in this function is also affecting all the following iterationswhich is almost certainly wrong.
Remove unnecessary type check on
field
inlift_leaves
since it is alwaysInt
Move a branch disabling
return nothing
higher upRemove some duplicated calculation on field index in
getfield_elim_pass!
Fix
try_compute_fieldidx
to returnnothing
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
thatisbits
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 branchesRef #26948 (fa02d34)
Ref #27126 (9100329)