Looking at the output of @descend_code_warntype reduce(vcat, eachcol(rand(2,2)))
on nightly, I find
Advanced: dump [P]arams cache.
%69 = invoke throw_boundserror(::Matrix{Float64},::Tuple{Base.Slice{Base.OneTo{Int64}}, Int64})::Union{}
%141 = invoke throw_setindex_mismatch(::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true},::Tuple{Int64})::Union{}
• %153 = invoke copyto!(::Matrix{Float64},::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true})::Any
↩
The return type of copyto!
is inferred as Any
. However, if I select the call, I find
copyto!(dest::AbstractArray, src::AbstractArray) @ Base abstractarray.jl:1044
Body::Matrix{Float64}
1045 1 ─ %1 = Base.getfield(src, :indices)::Tuple{Base.Slice{Base.OneTo{Int64}}, Int64} │╻╷╷╷╷ isempty
│ %2 = Core.getfield(%1, 1)::Base.Slice{Base.OneTo{Int64}} ││┃││ length
│ %3 = Base.getfield(%2, :indices)::Base.OneTo{Int64} │││┃││╷╷ size
│ %4 = Base.getfield(%3, :stop)::Int64 ││││╻╷ map
│ %5 = (%4 === 0)::Bool ││╻ ==
└── goto #3 if not %5 │
2 ─ return dest │
3 ─ nothing │
1050 4 ─ %9 = invoke Base.unalias(dest::Matrix{Float64}, src::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true})::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}
1051 │ %10 = invoke Base.copyto_unaliased!($(QuoteNode(IndexLinear()))::IndexLinear, dest::Matrix{Float64}, $(QuoteNode(IndexLinear()))::IndexLinear, %9::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true})::Matrix{Float64}
└── return %10 │
Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark.
Toggles: [o]ptimize, [w]arn, [h]ide type-stable statements, [d]ebuginfo, [r]emarks, [e]ffects, [i]nlining costs, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
Advanced: dump [P]arams cache.
• %9 = invoke unalias(::Matrix{Float64},::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true})::…
%10 = invoke copyto_unaliased!(::IndexLinear,::Array{…},::IndexLinear,::SubArray{…})::Matrix{Float64}
↩
In this, the return type seems to be concretely inferred as Matrix{Float64}
. How do I interpret the return type displayed in the parent call?