Skip to content

incomprehensible printing of :invoke statement with MethodInstance of Vararg signature #56485

@sgaure

Description

@sgaure

MWE, v1.11.1:

julia> @noinline f(x...) = (s = 0; for i in x; s += i; end; s)
julia> g(x...) = f(x...)
julia> @code_typed g(1,2,3)
CodeInfo(
1 ─ %1 = Core.getfield(x, 1)::Int64
│   %2 = Core.getfield(x, 2)::Int64
│   %3 = Core.getfield(x, 3)::Int64
│   %4 = invoke Main.f(%1::Int64, %2::Vararg{Int64}, %3)::Int64
└──      return %4
) => Int64

Why is there a %2::Vararg{Int64}, and nothing on %3?

(From https://discourse.julialang.org/t/spooky-allocations-linked-to-varargs/122373/2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions