From cfd7b64cbf228d9fdff65cd23efdc5f8ffabd351 Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Mon, 13 Mar 2023 21:03:13 +0900 Subject: [PATCH] add more test case for inference with overlayed method table This test case is particularily crafted for #48097, which has occurred a couple of times. Although the issue doesn't reproduce on master, having it here should help GPUCompiler keep working with the nightly. closes #48097 --- test/compiler/AbstractInterpreter.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/compiler/AbstractInterpreter.jl b/test/compiler/AbstractInterpreter.jl index fcb00eaa450198..ffd7117cd99be3 100644 --- a/test/compiler/AbstractInterpreter.jl +++ b/test/compiler/AbstractInterpreter.jl @@ -107,6 +107,17 @@ Base.@assume_effects :total totalcall(f, args...) = f(args...) end end |> only === Nothing +# GPUCompiler needs accurate inference through kwfunc with the overlay of `Core.throw_inexacterror` +# https://github.com/JuliaLang/julia/issues/48097 +@newinterp Issue48097Interp +@MethodTable Issue48097MT +CC.method_table(interp::Issue48097Interp) = CC.OverlayMethodTable(CC.get_world_counter(interp), Issue48097MT) +@overlay Issue48097MT @noinline Core.throw_inexacterror(f::Symbol, ::Type{T}, val) where {T} = return +issue48097(; kwargs...) = return 42 +@test fully_eliminated(; interp=Issue48097Interp(), retval=42) do + issue48097(; a=1f0, b=1.0) +end + # AbstractLattice # ===============