From 9d1ab9104bd19164c8dc2677a69710dd85c4184e Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Wed, 17 Jan 2024 20:02:52 +0900 Subject: [PATCH] fix CI on nightly --- src/abstractinterpret/typeinfer.jl | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/abstractinterpret/typeinfer.jl b/src/abstractinterpret/typeinfer.jl index 95eecf055..e703d8b23 100644 --- a/src/abstractinterpret/typeinfer.jl +++ b/src/abstractinterpret/typeinfer.jl @@ -442,6 +442,41 @@ function CC.finish!(analyzer::AbstractAnalyzer, frame::InferenceState) return ret end +# N.B. this overload essentially reverts JuliaLang/julia#50469 for type stability, +# but this is safe since `AbstractAnalyzer` doesn't currently support any compositions +# with other abstract interpreters +function CC._typeinf(analyzer::AbstractAnalyzer, frame::InferenceState) + CC.typeinf_nocycle(analyzer, frame) || return false # frame is now part of a higher cycle + # with no active ip's, frame is done + frames = frame.callers_in_cycle + isempty(frames) && push!(frames, frame) + valid_worlds = WorldRange() + for caller in frames + @assert !(caller.dont_work_on_me) + caller.dont_work_on_me = true + # might might not fully intersect these earlier, so do that now + valid_worlds = CC.intersect(caller.valid_worlds, valid_worlds) + end + for caller in frames + caller.valid_worlds = valid_worlds + CC.finish(caller, #=CHANGED caller.interp=#analyzer) + end + for caller in frames + opt = caller.result.src + if opt isa OptimizationState{typeof(analyzer)} # CHANGED: added {typeof(analyzer)} + CC.optimize(#=CHANGED caller.interp=#analyzer, opt, caller.result) + end + end + for caller in frames + finish!(#=CHANGED caller.interp=#analyzer, caller) + if CC.is_cached(caller) + CC.cache_result!(#=CHANGED caller.interp=#analyzer, caller.result) + end + end + empty!(frames) + return true +end + else # in this overload we can work on `frame.src::CodeInfo` (and also `frame::InferenceState`)