Skip to content

inference: use ssa_def_slot for InterConditional propagation #43147

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

Merged
merged 1 commit into from
Nov 19, 2021

Conversation

aviatesk
Copy link
Member

@aviatesk aviatesk commented Nov 19, 2021

This tweak should allow constraint propagation in following kind of cases:

julia> isaT(x, T) = isa(x, T);

# backward propagation
julia> @test Base.return_types((Any,Int)) do a, b
           c = a
           if isaT(c, typeof(b))
               return c # c::Int
           end
           return 0
       end |> only === Int;

# forward propagation
julia> @test Base.return_types((Any,Vector{Any})) do x, y
           z = x
           ifelse(isa(z, Int), z, length(y))
       end |> only === Int;

This tweak should allow constraint propagation in following kind of cases:
```julia
julia> isaT(x, T) = isa(x, T);

\# backward propagation
julia> @test Base.return_types((Any,Int)) do a, b
           c = a
           if isaT(c, typeof(b))
               return c # c::Int
           end
           return 0
       end |> only === Int;

\# forward propagation
julia> @test Base.return_types((Any,Vector{Any})) do x, y
           z = x
           ifelse(isa(z, Int), z, length(y))
       end |> only === Int;
```
@aviatesk aviatesk added the compiler:inference Type inference label Nov 19, 2021
@aviatesk aviatesk requested a review from vtjnash November 19, 2021 09:29
@vtjnash vtjnash merged commit 2c14d93 into master Nov 19, 2021
@vtjnash vtjnash deleted the avi/slotasssa branch November 19, 2021 16:37
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
…iaLang#43147)

This tweak should allow constraint propagation in following kind of cases:
```julia
julia> isaT(x, T) = isa(x, T);

\# backward propagation
julia> @test Base.return_types((Any,Int)) do a, b
           c = a
           if isaT(c, typeof(b))
               return c # c::Int
           end
           return 0
       end |> only === Int;

\# forward propagation
julia> @test Base.return_types((Any,Vector{Any})) do x, y
           z = x
           ifelse(isa(z, Int), z, length(y))
       end |> only === Int;
```
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
…iaLang#43147)

This tweak should allow constraint propagation in following kind of cases:
```julia
julia> isaT(x, T) = isa(x, T);

\# backward propagation
julia> @test Base.return_types((Any,Int)) do a, b
           c = a
           if isaT(c, typeof(b))
               return c # c::Int
           end
           return 0
       end |> only === Int;

\# forward propagation
julia> @test Base.return_types((Any,Vector{Any})) do x, y
           z = x
           ifelse(isa(z, Int), z, length(y))
       end |> only === Int;
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants