@@ -486,6 +486,7 @@ function CC.abstract_call_known(interp::AbstractGPUInterpreter, @nospecialize(f)
486
486
end
487
487
488
488
# Use the Inlining infrastructure to perform our refinement
489
+ # TODO : @aviatesk This is not reached on 1.11
489
490
function CC. handle_call! (todo:: Vector{Pair{Int,Any}} ,
490
491
ir:: CC.IRCode , idx:: CC.Int , stmt:: Expr , info:: DeferredCallInfo , flag:: UInt8 , sig:: CC.Signature ,
491
492
state:: CC.InliningState )
@@ -520,12 +521,11 @@ struct DeferredEdges
520
521
edges:: Vector{MethodInstance}
521
522
end
522
523
523
- function CC . ipo_dataflow_analysis! (interp :: AbstractGPUInterpreter , ir:: CC.IRCode , caller :: CC.InferenceResult )
524
+ function find_deferred_edges ( ir:: CC.IRCode )
524
525
edges = MethodInstance[]
525
- # @aviateks : Can we add this instead in handle_call
526
+ # @aviatesk : Can we add this instead in handle_call
526
527
for stmt in ir. stmts
527
528
inst = stmt[:inst ]
528
- @show inst
529
529
inst isa Expr || continue
530
530
expr = inst:: Expr
531
531
if expr. head === :foreigncall &&
@@ -535,11 +535,29 @@ function CC.ipo_dataflow_analysis!(interp::AbstractGPUInterpreter, ir::CC.IRCode
535
535
end
536
536
end
537
537
unique! (edges)
538
+ return edges
539
+ end
540
+
541
+ if VERSION >= v " 1.11.0-"
542
+ # stack_analysis_result and ipo_dataflow_analysis is 1.11 only
543
+ function CC. ipo_dataflow_analysis! (interp:: AbstractGPUInterpreter , ir:: CC.IRCode , caller:: CC.InferenceResult )
544
+ edges = find_deferred_edges (ir)
538
545
if ! isempty (edges)
539
546
CC. stack_analysis_result! (caller, DeferredEdges (edges))
540
547
end
541
548
@invoke CC. ipo_dataflow_analysis! (interp:: CC.AbstractInterpreter , ir:: CC.IRCode , caller:: CC.InferenceResult )
542
549
end
550
+ else
551
+ # v1.10.0
552
+ function CC. finish (interp:: AbstractGPUInterpreter , opt:: CC.OptimizationState , ir:: CC.IRCode , caller:: CC.InferenceResult )
553
+ edges = find_deferred_edges (ir)
554
+ if ! isempty (edges)
555
+ # This is a tad bit risky, but nobody should be running EA on our results.
556
+ caller. argescapes = DeferredEdges (edges)
557
+ end
558
+ @invoke CC. finish (interp:: CC.AbstractInterpreter , opt:: CC.OptimizationState , ir:: CC.IRCode , caller:: CC.InferenceResult )
559
+ end
560
+ end
543
561
544
562
# # world view of the cache
545
563
using Core. Compiler: WorldView
@@ -863,10 +881,16 @@ function compile_method_instance(@nospecialize(job::CompilerJob), compiled::IdDi
863
881
outstanding = Any[]
864
882
for mi in method_instances
865
883
ci = compiled[mi]. ci
866
- edges = CC. traverse_analysis_results (ci) do @nospecialize result
867
- return result isa DeferredEdges ? result : return
884
+ @static if VERSION >= v " 1.11.0-"
885
+ edges = CC. traverse_analysis_results (ci) do @nospecialize result
886
+ return result isa DeferredEdges ? result : return
887
+ end
888
+ else
889
+ edges = ci. argescapes
890
+ if ! (edges isa Union{Nothing, DeferredEdges})
891
+ edges = nothing
892
+ end
868
893
end
869
- @show edges
870
894
if edges != = nothing
871
895
for deferred_mi in (edges:: DeferredEdges ). edges
872
896
if ! haskey (compiled, deferred_mi)
0 commit comments