Hopefully someone who knows more can help with this, but I’ve seen this happen when the functions I’m using @code_warntype
on have keyword arguments:
function f1(a; b=2,c=3)
a*b
d = zeros(b, c*4)
end
julia> @code_warntype f1(1)
Variables
#self#::Core.Compiler.Const(f1, false)
a::Int64
Body::Array{Float64,2}
1 ─ %1 = Main.:(var"#f1#10")(2, 3, #self#, a)::Array{Float64,2}
└── return %1
If I add the kwargs when using @code_warntype
I get more output:
julia> @code_warntype f1(1;b=2,c=3)
Variables
#unused#::Core.Compiler.Const(var"#f1##kw"(), false)
@_2::NamedTuple{(:b, :c),Tuple{Int64,Int64}}
@_3::Core.Compiler.Const(f1, false)
a::Int64
b::Int64
c::Int64
@_7::Int64
@_8::Int64
Body::Array{Float64,2}
1 ─ %1 = Base.haskey(@_2, :b)::Core.Compiler.Const(true, false)
│ %1
│ (@_7 = Base.getindex(@_2, :b))
└── goto #3
2 ─ Core.Compiler.Const(:(@_7 = 2), false)
3 ┄ (b = @_7)
│ %7 = Base.haskey(@_2, :c)::Core.Compiler.Const(true, false)
│ %7
│ (@_8 = Base.getindex(@_2, :c))
└── goto #5
4 ─ Core.Compiler.Const(:(@_8 = 3), false)
5 ┄ (c = @_8)
│ %13 = (:b, :c)::Core.Compiler.Const((:b, :c), false)
│ %14 = Core.apply_type(Core.NamedTuple, %13)::Core.Compiler.Const(NamedTuple{(:b, :c),T} where T<:Tuple, false)
│ %15 = Base.structdiff(@_2, %14)::Core.Compiler.Const(NamedTuple(), false)
│ %16 = Base.pairs(%15)::Core.Compiler.Const(Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}(), false)
│ %17 = Base.isempty(%16)::Core.Compiler.Const(true, false)
│ %17
└── goto #7
6 ─ Core.Compiler.Const(:(Base.kwerr(@_2, @_3, a)), false)
7 ┄ %21 = Main.:(var"#f1#10")(b, c, @_3, a)::Array{Float64,2}
└── return %21