Add descend with constant arguments
Sometimes inference decides that const prop is not worthwhile and in order to debug those decisions we should add the option to enter a call side with const information
X-ref: https://github.com/JuliaLang/julia/pull/29261
Cc: @simeonschaub who had a good example
It's easy to start descending with const arguments with something like:
descend((T,)) do typearg
foo(constarg, typearg)
end
Could you elaborate what we want a bit more ?
I want to start with an actual Const lattice element. Not even necessarily from the top-level.
But sometimes I come across a call site that has all const arguments and it didn't get constant-propped. So I want to explore why.
Are we making use of the messages that get passed back?
julia> interp.msgs
Dict{Core.MethodInstance, Vector{Pair{Int64, String}}} with 6 entries:
MethodInstance for Base.indexed_iterate(::Tuple{Float64, Int64… => [3=>"[constprop] Disabled by function heuristic", 3=>"[constprop] Disabled by function heuristic"]
MethodInstance for isempty(::OneTo{Int64}) => [3=>"[constprop] Disabled by function heuristic"]
MethodInstance for Base.collect_to_with_first!(::Vector{Float6… => [3=>"[constprop] Disabled by function heuristic", 3=>"Call result type was widened because the return value is unused"]
MethodInstance for iterate(::OneTo{Int64}, ::Int64) => [9=>"[constprop] Disabled by function heuristic"]
MethodInstance for max(::Int64, ::Int64) => [1=>"[constprop] Disabled by function heuristic"]
MethodInstance for Base.collect_to!(::Vector{Float64}, ::Ge… => [25=>"Call result type was widened because the return value is unused", 29=>"[constprop] Disabled by function heuristic", 25=>"[co…
No, we don't show them in our UI in anyway right now. Maybe we want to show them aside of callsites that failed to constprop ?