Skip to content
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

type stability of backslash #152

Closed
StefanKarpinski opened this issue Nov 28, 2014 · 0 comments · Fixed by JuliaLang/julia#9779
Closed

type stability of backslash #152

StefanKarpinski opened this issue Nov 28, 2014 · 0 comments · Fixed by JuliaLang/julia#9779
Assignees
Labels
performance Must go faster

Comments

@StefanKarpinski
Copy link
Member

Note that _var8 is Array{Any,1} and the backslash method as a whole has inferred return type Any:

julia> (@code_typed rand(3,3)\rand(3))[1].args[2][2]
19-element Array{Any,1}:
 Any[:A,Array{Float64,2},0]
 Any[:B,Array{Float64,1},0]
 Any[symbol("#s1986"),(Int64,Int64),18]
 Any[symbol("#s1984"),(Int64,Int64),18]
 Any[:m,Int64,18]
 Any[symbol("#s1983"),(Int64,Int64),18]
 Any[:n,Int64,18]
 Any[symbol("#s1985"),Int64,2]
 Any[:_var1,Array{Float64,1},18]
 Any[:_var0,Int64,18]
 Any[:_var4,Int64,18]
 Any[:_var5,Array{Float64,2},18]
 Any[:_var8,Array{Any,1},18]
 Any[:_var2,Int64,18]
 Any[:_var3,Int64,18]
 Any[:_var6,Int64,18]
 Any[:_var7,Int64,18]
 Any[:_var9,Int64,18]
 Any[:_var10,Int64,18]

julia> (@code_typed rand(3,3)\rand(3))[1].args[3]
:(begin  # linalg/dense.jl, line 409:
        _var2 = (top(arraysize))(A::Array{Float64,2},1)::Int64
        _var3 = (top(arraysize))(A::Array{Float64,2},2)::Int64
        #s1985 = 1
        _var6 = _var2::Int64
        _var7 = (top(box))(Int64,(top(add_int))(1,1))::Int64
        m = _var6::Int64
        #s1985 = _var7::Int64
        _var9 = _var3::Int64
        _var10 = (top(box))(Int64,(top(add_int))(2,1))::Int64
        n = _var9::Int64
        #s1985 = _var10::Int64 # line 410:
        unless m::Int64 === n::Int64::Bool goto 3 # line 411:
        unless istril(A::Array{Float64,2})::Bool goto 1 # line 412:
        unless istriu(A::Array{Float64,2})::Bool goto 0
        _var1 = getindex(A::Array{Float64,2},diagind((top(arraysize))(A::Array{Float64,2},1)::Int64,(top(arraysize))(A::Array{Float64,2},2)::Int64,0)::StepRange{Int64,Int64})::Array{Float64,1}
        return $(Expr(:new, Diagonal{Float64}, :(_var1::Array{Float64,1})))::Diagonal{Float64} \ B::Array{Float64,1}::Array{Float64,1}
        0:
        chksquare(A::Array{Float64,2})::Int64
        return ((top(apply_type))(Triangular,Float64,typeof(A::Array{Float64,2})::Type{Array{Float64,2}},:L,false)::Type{_<:Triangular{Float64,Array{Float64,2},UpLo,IsUnit}})(A::Array{Float64,2})::Triangular{T,S<:AbstractArray{T,2},UpLo,IsUnit} \ B::Array{Float64,1}
        1:  # line 414:
        unless istriu(A::Array{Float64,2})::Bool goto 2
        chksquare(A::Array{Float64,2})::Int64
        return ((top(apply_type))(Triangular,Float64,typeof(A::Array{Float64,2})::Type{Array{Float64,2}},:U,false)::Type{_<:Triangular{Float64,Array{Float64,2},UpLo,IsUnit}})(A::Array{Float64,2})::Triangular{T,S<:AbstractArray{T,2},UpLo,IsUnit} \ B::Array{Float64,1}
        2:  # line 415:
        _var8 = (top(ccall))(:jl_alloc_array_1d,$(Expr(:call1, :(top(apply_type)), :Array, Any, 1))::Type{Array{Any,1}},$(Expr(:call1, :(top(tuple)), :Any, :Int))::(Type{Any},Type{Int64}),Array{Any,1},0,2,0)::Array{Any,1}
        _var4 = (top(arraysize))(A::Array{Float64,2},1)::Int64
        _var0 = (top(arraysize))(A::Array{Float64,2},2)::Int64
        _var5 = (top(ccall))(:jl_alloc_array_2d,$(Expr(:call1, :(top(apply_type)), :Array, Float64, 2))::Type{Array{Float64,2}},$(Expr(:call1, :(top(tuple)), :Any, :Int, :Int))::(Type{Any},Type{Int64},Type{Int64}),Array{Float64,2},0,_var4::Int64,0,_var0::Int64,0)::Array{Float64,2}
        return (top(kwcall))(call,1,:pivot,true,lufact!,_var8::Array{Any,1},copy!(_var5::Array{Float64,2},1,A::Array{Float64,2},1,(top(arraylen))(A::Array{Float64,2})::Int64)::Array{Float64,2})::LU{Float64,Array{Float64,2}} \ B::Array{Float64,1}::Array{Float64,1}
        3:  # line 417:
        return (top(kwcall))(call,1,:pivot,Float64 <: BlasFloat::Bool,qrfact,(top(ccall))(:jl_alloc_array_1d,$(Expr(:call1, :(top(apply_type)), :Array, Any, 1))::Type{Array{Any,1}},$(Expr(:call1, :(top(tuple)), :Any, :Int))::(Type{Any},Type{Int64}),Array{Any,1},0,2,0)::Array{Any,1},A::Array{Float64,2})::Union(QRPivoted{Float64},QRCompactWY{Float64}) \ B::Array{Float64,1}
    end)
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants