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
de-duplicate union type splitting inference for duplicate loads of immutable fields #39888
Comments
Okay, I have finally reduced the problem:
Two issues:
|
Yes, we don't forward information from duplicate loads. This is one of several reasons we typically try to recommend using the native sum type |
Just to be sure - does this also explain the fact that |
|
Since Julia unfortuantely still cannot propagate information from immutable fields loaded twice (see JuliaLang#39888, JuliaLang#41199), these kind of changes are necessary to achieve type stability.
This will be closed by #47574, if it gets merged. |
Edit 2023-03-17: Reduced example
Here is a small working example:
Now check
g(1)
:@code_warntype
shows some type instability here, e.g. the finalsome
appears to be able to be anOption{Nothing}
, which would throw an error on the typeassert@code_native
shows no error-throwing code, so it conflicts with@code_warntype
.Another issue which may or may not be related: Check
@code_native h(1)
. It compiles to a singleleaq
instruction as expected. However, when putting it in a loop:it does not vectorize, even though this should be very easy to vectorize.
The text was updated successfully, but these errors were encountered: