If you write a method that ends up being inferred to a Const(...) return value:
julia> const k = rand(1:100)
61
julia> foo() = *(k, 15, 12)
julia> @code_typed foo()
CodeInfo(
1 ─ return 10980
) => Int64
it will not be included in the --trace-compile output:
$ julia --trace-compile=stderr -e "const k = rand(1:100); (foo() = *(k, 15)); println(foo())"
precompile(Tuple{typeof(Base.rand), Base.UnitRange{Int64}})
precompile(Tuple{typeof(Base.println), Int64})
precompile(Tuple{typeof(Base.println), Base.TTY, Int64})
705
Even though we ran our compilation pipeline on foo() for the first time (generating a new CodeInstance), it ended up not needing to compile via LLVM so it is excluded from the output.
A user may hope to use the output of --trace-compile to determine whether they should add precompile(foo, ()) to the pre-compilation workload, If we had reported this MethodInstance, it would have saved them that inference time.
EDIT: Attaching this to the umbrella issue for trace-compile / precompile errors: #58756
If you write a method that ends up being inferred to a
Const(...)return value:it will not be included in the
--trace-compileoutput:Even though we ran our compilation pipeline on
foo()for the first time (generating a new CodeInstance), it ended up not needing to compile via LLVM so it is excluded from the output.A user may hope to use the output of
--trace-compileto determine whether they should addprecompile(foo, ())to the pre-compilation workload, If we had reported this MethodInstance, it would have saved them that inference time.EDIT: Attaching this to the umbrella issue for trace-compile / precompile errors: #58756