julia
01c07780 - effects: add effects analysis for array construction (#46015)

Commit
3 years ago
effects: add effects analysis for array construction (#46015) This commit implements an infrastructure to analyze effects of `:foreigncall` expression, and especially implements effects analysis for array constructions. Some improvements: ```julia julia> @noinline construct_array(@nospecialize(T), args...) = Array{T}(undef, args...); julia> function check_dims(T, dims) construct_array(T, dims...) return nothing end; ``` ```julia julia> code_typed() do check_dims(Int, (1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..38e2d3553d 100644 --- a/_master +++ b/_pr @@ -1,6 +1,4 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 +1 ─ return nothing ) => Nothing ``` ```julia julia> code_typed() do check_dims(Int, (-1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..e5e724db10 100644 --- a/_master +++ b/_pr @@ -1,6 +1,5 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 -) => Nothing +1 ─ invoke Main.check_dims(Main.Int::Type, (-1, 2, 3)::Tuple{Int64, Int64, Int64})::Union{} +└── unreachable +) => Union{} ```
Author
Parents
Loading