Dispatch on Value allocating

Yes, it generally will.

julia> f() = ntuple(x -> x + 5, Val(2))
f (generic function with 2 methods)

julia> @code_llvm f()

;  @ REPL[45]:1 within `f'
define void @julia_f_12684([2 x i64]* noalias nocapture sret) {
top:
  %1 = bitcast [2 x i64]* %0 to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast ([2 x i64]* @0 to i8*), i64 16, i32 8, i1 false)
  ret void
}

julia> @code_native f()
        .section        __TEXT,__text,regular,pure_instructions
; ┌ @ REPL[49]:1 within `f'
        decl    %eax
        movl    $429409128, %eax        ## imm = 0x19984368
        addl    %eax, (%eax)
        addb    %al, (%eax)
        vmovups (%eax), %xmm0
        vmovups %xmm0, (%edi)
        decl    %eax
        movl    %edi, %eax
        retl
        nopw    %cs:(%eax,%eax)
; └
1 Like