@@ -15,22 +15,13 @@ Cthulhu.get_cursor(c::ADCursor, cs::Cthulhu.Callsite) = Cthulhu.get_cursor(c, cs
15
15
Cthulhu.get_cursor(c::ADCursor, callinfo) = ADCursor(c.level, Cthulhu.get_mi(callinfo))
16
16
=#
17
17
18
-
19
18
struct ADGraph
20
19
code:: OffsetVector{Dict{MethodInstance, Any}}
21
20
msgs:: Vector{Tuple{Int, MethodInstance, Int, String}}
22
21
entry_mi:: MethodInstance
23
22
end
24
23
entrypoint (graph:: ADGraph ) = ADCursor (0 , graph. entry_mi)
25
24
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
-
34
25
using Core: MethodInstance, CodeInstance
35
26
using . CC: AbstractInterpreter, ArgInfo, Effects, InferenceResult, InferenceState,
36
27
IRInterpretationState, NativeInterpreter, OptimizationState, StmtInfo, WorldRange
@@ -275,23 +266,17 @@ CC.may_compress(ei::ADInterpreter) = false
275
266
CC. may_discard_trees (ei:: ADInterpreter ) = false
276
267
277
268
function 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
279
270
push! (get! (Cthulhu. PC2Remarks, interp. remarks[interp. current_level], key), sv. currpc=> msg)
280
271
end
281
272
282
273
# TODO : `get_remarks` should get a cursor?
283
274
Cthulhu. get_remarks (interp:: ADInterpreter , key:: Union{MethodInstance,InferenceResult} ) = get (interp. remarks[interp. current_level], key, nothing )
284
275
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)
295
280
return res
296
281
end
297
282
0 commit comments