@@ -461,6 +461,7 @@ function CC.abstract_call_known(interp::AbstractGPUInterpreter, @nospecialize(f)
461
461
end
462
462
463
463
# Use the Inlining infrastructure to perform our refinement
464
+ # TODO : @aviatesk This is not reached on 1.11
464
465
function CC. handle_call! (todo:: Vector{Pair{Int,Any}} ,
465
466
ir:: CC.IRCode , idx:: CC.Int , stmt:: Expr , info:: DeferredCallInfo , flag:: UInt8 , sig:: CC.Signature ,
466
467
state:: CC.InliningState )
@@ -495,12 +496,11 @@ struct DeferredEdges
495
496
edges:: Vector{MethodInstance}
496
497
end
497
498
498
- function CC . ipo_dataflow_analysis! (interp :: AbstractGPUInterpreter , ir:: CC.IRCode , caller :: CC.InferenceResult )
499
+ function find_deferred_edges ( ir:: CC.IRCode )
499
500
edges = MethodInstance[]
500
- # @aviateks : Can we add this instead in handle_call
501
+ # @aviatesk : Can we add this instead in handle_call
501
502
for stmt in ir. stmts
502
503
inst = stmt[:inst ]
503
- @show inst
504
504
inst isa Expr || continue
505
505
expr = inst:: Expr
506
506
if expr. head === :foreigncall &&
@@ -510,11 +510,29 @@ function CC.ipo_dataflow_analysis!(interp::AbstractGPUInterpreter, ir::CC.IRCode
510
510
end
511
511
end
512
512
unique! (edges)
513
+ return edges
514
+ end
515
+
516
+ if VERSION >= v " 1.11.0-"
517
+ # stack_analysis_result and ipo_dataflow_analysis is 1.11 only
518
+ function CC. ipo_dataflow_analysis! (interp:: AbstractGPUInterpreter , ir:: CC.IRCode , caller:: CC.InferenceResult )
519
+ edges = find_deferred_edges (ir)
513
520
if ! isempty (edges)
514
521
CC. stack_analysis_result! (caller, DeferredEdges (edges))
515
522
end
516
523
@invoke CC. ipo_dataflow_analysis! (interp:: CC.AbstractInterpreter , ir:: CC.IRCode , caller:: CC.InferenceResult )
517
524
end
525
+ else
526
+ # v1.10.0
527
+ function CC. finish (interp:: AbstractGPUInterpreter , opt:: CC.OptimizationState , ir:: CC.IRCode , caller:: CC.InferenceResult )
528
+ edges = find_deferred_edges (ir)
529
+ if ! isempty (edges)
530
+ # This is a tad bit risky, but nobody should be running EA on our results.
531
+ caller. argescapes = DeferredEdges (edges)
532
+ end
533
+ @invoke CC. finish (interp:: CC.AbstractInterpreter , opt:: CC.OptimizationState , ir:: CC.IRCode , caller:: CC.InferenceResult )
534
+ end
535
+ end
518
536
519
537
# # world view of the cache
520
538
using Core. Compiler: WorldView
@@ -797,10 +815,16 @@ function compile_method_instance(@nospecialize(job::CompilerJob), compiled::IdDi
797
815
outstanding = Any[]
798
816
for mi in method_instances
799
817
ci = compiled[mi]. ci
800
- edges = CC. traverse_analysis_results (ci) do @nospecialize result
801
- return result isa DeferredEdges ? result : return
818
+ @static if VERSION >= v " 1.11.0-"
819
+ edges = CC. traverse_analysis_results (ci) do @nospecialize result
820
+ return result isa DeferredEdges ? result : return
821
+ end
822
+ else
823
+ edges = ci. argescapes
824
+ if ! (edges isa Union{Nothing, DeferredEdges})
825
+ edges = nothing
826
+ end
802
827
end
803
- @show edges
804
828
if edges != = nothing
805
829
for deferred_mi in (edges:: DeferredEdges ). edges
806
830
if ! haskey (compiled, deferred_mi)
0 commit comments