@@ -64,23 +64,16 @@ function ir_to_src(ir::IRCode)
6464end
6565
6666function cache_dae_ci! (old_ci, src, debuginfo, abi, owner)
67- edges = Core. svec (old_ci)
67+ mi = old_ci. def
68+ edges = Core. svec (mi)
6869 daef_ci = CodeInstance (abi === nothing ? old_ci. def : Core. ABIOverride (abi, old_ci. def), owner, Tuple, Union{}, nothing , src, Int32 (0 ),
6970 UInt (1 )#= ci.min_world=# , old_ci. max_world, old_ci. ipo_purity_bits,
7071 nothing , debuginfo, edges)
71- add_backedges_to_callees (daef_ci, edges )
72- ccall (:jl_mi_cache_insert , Cvoid, (Any, Any), old_ci . def , daef_ci)
72+ ccall ( :jl_method_instance_add_backedge , Cvoid, (Any, Any, Any), mi, nothing , daef_ci )
73+ ccall (:jl_mi_cache_insert , Cvoid, (Any, Any), mi , daef_ci)
7374 return daef_ci
7475end
7576
76- # Equivalent to `Compiler.store_backedges` in our case, but we allow `caller.def.def` to not be a `Method`.
77- function add_backedges_to_callees (caller:: CodeInstance , edges:: SimpleVector )
78- for edge in edges
79- isa (edge, CodeInstance) && (edge = edge. def)
80- ccall (:jl_method_instance_add_backedge , Cvoid, (Any, Any, Any), edge:: MethodInstance , nothing , caller)
81- end
82- end
83-
8477function replace_call! (ir:: Union{IRCode,IncrementalCompact} , idx:: SSAValue , new_call:: Expr )
8578 @assert ! isa (ir[idx][:inst ], PhiNode)
8679 ir[idx][:inst ] = new_call
0 commit comments