@@ -15,22 +15,13 @@ Cthulhu.get_cursor(c::ADCursor, cs::Cthulhu.Callsite) = Cthulhu.get_cursor(c, cs
1515Cthulhu.get_cursor(c::ADCursor, callinfo) = ADCursor(c.level, Cthulhu.get_mi(callinfo))
1616=#
1717
18-
1918struct ADGraph
2019 code:: OffsetVector{Dict{MethodInstance, Any}}
2120 msgs:: Vector{Tuple{Int, MethodInstance, Int, String}}
2221 entry_mi:: MethodInstance
2322end
2423entrypoint (graph:: ADGraph ) = ADCursor (0 , graph. entry_mi)
2524
26- #=
27- Compiler3.has_codeinfo(graph::ADGraph, cursor::ADCursor) =
28- lastindex(graph.code) >= cursor.level && haskey(graph.code[cursor.level], cursor.mi)
29- function Compiler3.get_codeinstance(graph::ADGraph, cursor::ADCursor)
30- return graph.code[cursor.level][cursor.mi]
31- end
32- =#
33-
3425using Core: MethodInstance, CodeInstance
3526using . CC: AbstractInterpreter, ArgInfo, Effects, InferenceResult, InferenceState,
3627 IRInterpretationState, NativeInterpreter, OptimizationState, StmtInfo, WorldRange
@@ -275,23 +266,17 @@ CC.may_compress(ei::ADInterpreter) = false
275266CC. may_discard_trees (ei:: ADInterpreter ) = false
276267
277268function CC. add_remark! (interp:: ADInterpreter , sv:: InferenceState , msg)
278- key = CC. any (sv. result. overridden_by_const) ? sv. result : sv. linfo
269+ key = ( @static VERSION ≥ v " 1.12.0-DEV.317 " ? CC. is_constproped (sv) : CC . any (sv. result. overridden_by_const) ) ? sv. result : sv. linfo
279270 push! (get! (Cthulhu. PC2Remarks, interp. remarks[interp. current_level], key), sv. currpc=> msg)
280271end
281272
282273# TODO : `get_remarks` should get a cursor?
283274Cthulhu. get_remarks (interp:: ADInterpreter , key:: Union{MethodInstance,InferenceResult} ) = get (interp. remarks[interp. current_level], key, nothing )
284275
285- #=
286- function CC.const_prop_heuristic(interp::AbstractInterpreter, method::Method, mi::MethodInstance)
287- return true
288- end
289- =#
290-
291- function CC. finish (state:: InferenceState , interp:: ADInterpreter )
292- res = @invoke CC. finish (state:: InferenceState , interp:: AbstractInterpreter )
293- key = CC. any (state. result. overridden_by_const) ? state. result : state. linfo
294- interp. unopt[interp. current_level][key] = Cthulhu. InferredSource (state)
276+ function CC. finish (sv:: InferenceState , interp:: ADInterpreter )
277+ res = @invoke CC. finish (sv:: InferenceState , interp:: AbstractInterpreter )
278+ key = (@static VERSION ≥ v " 1.12.0-DEV.317" ? CC. is_constproped (sv) : CC. any (sv. result. overridden_by_const)) ? sv. result : sv. linfo
279+ interp. unopt[interp. current_level][key] = Cthulhu. InferredSource (sv)
295280 return res
296281end
297282
0 commit comments