Skip to content

Conversation

@Keno
Copy link
Member

@Keno Keno commented Sep 18, 2022

@aviatesk This was my attempt at #46791 while retaining some precision. Untested, but maybe it helps.

end

"""
has_non_dt_typevar(typ, v) -> Bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have an existing version of this in Test which is much less conservative (it does methods lookups too)? Should we try to unify them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're talking about Test.constrains_param?

@aviatesk aviatesk changed the base branch from master to avi/46771 September 19, 2022 21:08
@aviatesk aviatesk marked this pull request as ready for review September 19, 2022 21:09
@ianatol ianatol self-requested a review September 19, 2022 23:26
@ianatol
Copy link
Member

ianatol commented Sep 23, 2022

Seems good to me --- are the test failures related to deletion that now occurs due to increased effects accuracy?

@oscardssmith
Copy link
Member

@Keno what's the status of this? Do we want it?

@brenhinkeller brenhinkeller added the compiler:effects effect analysis label Nov 17, 2022
@aviatesk aviatesk force-pushed the avi/46771 branch 2 times, most recently from 423b939 to dd6aab0 Compare December 9, 2022 01:49
@aviatesk aviatesk force-pushed the kf/sparammodeling branch 2 times, most recently from 609f039 to 6181f20 Compare December 9, 2022 01:56
@aviatesk aviatesk force-pushed the kf/sparammodeling branch 6 times, most recently from eb08722 to 5fbbd34 Compare February 7, 2023 12:36
@aviatesk aviatesk merged commit 0da756b into avi/46771 Feb 7, 2023
@aviatesk aviatesk deleted the kf/sparammodeling branch February 7, 2023 14:28
Keno added a commit that referenced this pull request Feb 8, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)

With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```

This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```

* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)

* Fix test with free type params

* Test: Ignore ::Type{T} in detect_unbounded

These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.

---------

Co-authored-by: Keno Fischer <[email protected]>
Co-authored-by: Elliot Saba <[email protected]>
KristofferC pushed a commit that referenced this pull request Feb 20, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)

With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```

This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```

* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)

* Fix test with free type params

* Test: Ignore ::Type{T} in detect_unbounded

These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.

---------

Co-authored-by: Keno Fischer <[email protected]>
Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit b5d17ea)
KristofferC pushed a commit that referenced this pull request Feb 20, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)

With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```

This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```

* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)

* Fix test with free type params

* Test: Ignore ::Type{T} in detect_unbounded

These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.

---------

Co-authored-by: Keno Fischer <[email protected]>
Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit b5d17ea)
KristofferC pushed a commit that referenced this pull request Feb 20, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)

With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```

This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```

* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)

* Fix test with free type params

* Test: Ignore ::Type{T} in detect_unbounded

These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.

---------

Co-authored-by: Keno Fischer <[email protected]>
Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit b5d17ea)
KristofferC pushed a commit that referenced this pull request Feb 21, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)

With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```

This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```

* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)

* Fix test with free type params

* Test: Ignore ::Type{T} in detect_unbounded

These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.

---------

Co-authored-by: Keno Fischer <[email protected]>
Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit b5d17ea)
KristofferC pushed a commit that referenced this pull request Feb 21, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)

With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```

This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```

* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)

* Fix test with free type params

* Test: Ignore ::Type{T} in detect_unbounded

These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.

---------

Co-authored-by: Keno Fischer <[email protected]>
Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit b5d17ea)
KristofferC pushed a commit that referenced this pull request Feb 21, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)

With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```

This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```

* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)

* Fix test with free type params

* Test: Ignore ::Type{T} in detect_unbounded

These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.

---------

Co-authored-by: Keno Fischer <[email protected]>
Co-authored-by: Elliot Saba <[email protected]>
(cherry picked from commit b5d17ea)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:effects effect analysis

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants